Skip to main content

Memgraph database adapter for Python language

Project description

pymgclient - Memgraph database adapter for Python language

pymgclient is a Memgraph database adapter for Python programming language compliant with the DB-API 2.0 specification described by PEP 249.

mgclient module is the current implementation of the adapter. It is implemented in C as a wrapper around mgclient, the official Memgraph client library. As a C extension, it is only compatible with the CPython implementation of the Python programming language.

pymgclient only works with Python 3.

Check out the documentation if you need help with installation or if you want to build pymgclient for yourself!

Documentation

Online documentation can be found on GitHub pages.

You can also build a local version of the documentation by running make from the docs directory. You will need Sphinx installed in order to do that.

Code sample

Here is an example of an interactive session showing some of the basic commands:

>>> import mgclient

# Make a connection to the database
>>> conn = mgclient.connect(host='127.0.0.1', port=7687)

# Create a cursor for query execution
>>> cursor = conn.cursor()

# Execute a query
>>> cursor.execute("""
        CREATE (n:Person {name: 'John'})-[e:KNOWS]->
               (m:Person {name: 'Steve'})
        RETURN n, e, m
    """)

# Fetch one row of query results
>>> row = cursor.fetchone()

>>> print(row[0])
(:Person {'name': 'John'})

>>> print(row[1])
[:KNOWS]

>>> print(row[2])
(:Person {'name': 'Steve'})

# Make database changes persistent
>>> conn.commit()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymgclient-1.0.0.tar.gz (133.7 kB view hashes)

Uploaded Source

Built Distributions

pymgclient-1.0.0-cp39-cp39-win_amd64.whl (69.4 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

pymgclient-1.0.0-cp39-cp39-macosx_10_15_x86_64.whl (53.8 kB view hashes)

Uploaded CPython 3.9 macOS 10.15+ x86-64

pymgclient-1.0.0-cp38-cp38-win_amd64.whl (69.2 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

pymgclient-1.0.0-cp38-cp38-macosx_10_15_x86_64.whl (53.8 kB view hashes)

Uploaded CPython 3.8 macOS 10.15+ x86-64

pymgclient-1.0.0-cp37-cp37m-win_amd64.whl (68.6 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

pymgclient-1.0.0-cp37-cp37m-macosx_10_15_x86_64.whl (53.6 kB view hashes)

Uploaded CPython 3.7m macOS 10.15+ x86-64

pymgclient-1.0.0-cp36-cp36m-win_amd64.whl (68.6 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page