Skip to main content

Light: 'Resume application project app icon' Dark: 'Resume application project app icon'

Polypheny Connector for Python

This enables Python programs to access Polypheny databases, using an API that is compliant with the Python Database API Specification v2.0 (PEP 249).

Installation

The recommended way to install the Python Connector for Polypheny is via pip:

pip install polypheny

Alternatively, if you prefer to install the package manually you can also download the latest release, extract the archive and install it manually:

cd /path/to/polyphney-connector-python-x.y.z/
python setup.py install

The connector uses the Prism 2.4 client definitions and connects to servers that report a compatible Prism 2.x API. The minor versions do not have to match. Document collection metadata requires server-side support introduced in Prism 2.2. PEP 249 error classification uses SQLSTATE details from Prism 2.4 servers. Errors from older servers raise DatabaseError with sqlstate=None and errorcode=None.

Getting Started

A few examples of the most common functionalities provided by the adapter:

import polypheny

# Connect to locally running Polypheny via UNIX sockets (on Linux, BSD and macOS)
con = polypheny.connect()

# Unencrypted over the network (all systems)
con = polypheny.connect(
  ('127.0.0.1', 20590),
  username='pa',
  password='',
  transport='plain',
)

# Get a cursor
cursor = con.cursor()

# Create a new table
cursor.execute("CREATE TABLE dummy (id INT NOT NULL, text VARCHAR(2), num INT, PRIMARY KEY(id))")

# Insert values into table
cursor.execute("INSERT INTO dummy VALUES (407 , 'de', 93)")
con.commit()

# Execute a query
cursor.execute("SELECT * from dummy")

print("\nRelational results from SQL")
for row in cursor:
    print("\t", row)

# Accessing data using MQL
cursor.executeany('mongo', 'db.dummy.find()', namespace='public')

print("\nDocument results from MQL (as Python dicts)")
for doc in cursor:
    print("\t", doc)

cursor.execute("DROP TABLE dummy")

# Close the connection
con.close()

An in-depth and more detailed documentation can be found here.

Tests

Run the tests with a coverage report against an isolated Polypheny instance.

coverage run --source polypheny -m pytest && coverage report -m

The constraint tests read the test server's runtime settings through its Web UI at http://127.0.0.1:7659. Set POLYPHENY_TEST_WEBUI_URL if the same test server exposes its Web UI at a different address.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

We highly welcome your contributions to the Polypheny Connector for Python. If you would like to contribute, please fork the repository and submit your changes as a pull request. Please consult our Admin Repository and our Website for guidelines and additional information.

Please note that we have a code of conduct. Please follow it in all your interactions with the project.

License

The Apache 2.0 License

Metadata

Release files for polypheny 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polypheny 2.2.0
File Size Uploaded Provenance Actions
polypheny-2.2.0.tar.gz 46.4 kB With provenance Details for polypheny-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for polypheny 2.2.0
File Interpreter ABI Platform Actions
polypheny-2.2.0-py3-none-any.whl Python 3 none any Details for polypheny-2.2.0-py3-none-any.whl

Total release size: 64.6 kB

Release files / polypheny-2.2.0.tar.gz

Download URL polypheny-2.2.0.tar.gz
Size 46.4 kB
Tags Source
SHA-256 checksum
How to use checksums
eb8c79e2dd8c0e1641efddf83d36068508cf65d0d9ca1c57f6c5d19c9ee3e3f4
BLAKE2b-256 checksum
How to use checksums
e4ec7bec9104b15a900e4f073b23a73df91162d5e15188464b65493336997d94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / polypheny-2.2.0-py3-none-any.whl

Download URL polypheny-2.2.0-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
150a2f814f41a8cb41324ec117145c71469d50101d1a598fb554d39a12c0dffb
BLAKE2b-256 checksum
How to use checksums
2a100edd4c8b9ad29cad44664807ae5b26d678c16fabf80fcc8d5598ba9cdf9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for polypheny 2.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for polypheny-2.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page