Skip to content

An SDK for calling the Senzing C library via gRPC network requests.

License

Notifications You must be signed in to change notification settings

senzing-garage/sz-sdk-python-grpc

Repository files navigation

sz-sdk-python-grpc

If you are beginning your journey with Senzing, please start with Senzing Quick Start guides.

You are in the Senzing Garage where projects are "tinkered" on. Although this GitHub repository may help you understand an approach to using Senzing, it's not considered to be "production ready" and is not considered to be part of the Senzing product. Heck, it may not even be appropriate for your application of Senzing!

⚠️ WARNING: sz-sdk-python-grpc is still in development ⚠️ _

At the moment, this is "work-in-progress" with Semantic Versions of 0.n.x. Although it can be reviewed and commented on, the recommendation is not to use it yet.

Synopsis

The Senzing sz-sdk-python-grpc package provides a Python Software Development Kit adhering to the abstract classes of sz-sdk-python that communicates with a Senzing gRPC server.

Python 3.11 Badge PEP8 Badge PyPI version Badge Downloads Badge [License Badge][License] Coverage Badge

Overview

The Senzing sz-sdk-python-grpc packages enable Python programs to call Senzing library functions across a network to a Senzing gRPC server.

The sz-sdk-python-grpc package implements the following sz-sdk-python interfaces:

  1. [SzConfig]
  2. [SzConfigMgr]
  3. [SzDiagnostic]
  4. [SzEngine]
  5. [SzProduct]

Other implementations of the sz-sdk-python interface include:

Use

The following example shows how to start a Senzing gRPC server Docker container and access it using the senzing_grpc Python package.

  1. Install the senzing-grpc Python package. Example:

    python3 -m pip install --upgrade senzing-grpc
  2. Run a Senzing gRPC service using Docker. Example:

    docker run \
      --env SENZING_TOOLS_COMMAND=serve-grpc \
      --env SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@nowhere/tmp/sqlite/G2C.db \
      --env SENZING_TOOLS_ENABLE_ALL=true \
      --name senzing-tools-serve-grpc \
      --publish 8261:8261 \
      --pull always \
      --rm \
      senzing/senzing-tools

    Note: In this example, SENZING_TOOLS_DATABASE_URL specifies a file inside the container. Thus the database is temporal and will be deleted when the container is killed.

  3. In a separate window, start an interactive Python session. Example:

    python3
  4. Paste the following into the interactive Python session. Example:

    import grpc
    from senzing_grpc import SzAbstractFactory
    sz_abstract_factory = SzAbstractFactory(grpc_channel=grpc.insecure_channel("localhost:8261"))
    sz_product = sz_abstract_factory.create_product()
    print(sz_product.get_version())

More can be seen in Examples.

References

  1. Development
  2. Errors
  3. Examples
  4. Related artifacts:
    1. DockerHub
  5. sz-sdk-python package reference

About

An SDK for calling the Senzing C library via gRPC network requests.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published