Skip to main content

GQLAlchemy is a library developed to assist with writing and running queries in Memgraph.

Project description

GQLAlchemy

Code style: black

GQLAlchemy is a fully open-source Python library and Object Graph Mapper (OGM) - a link between graph database objects and Python objects.

An Object Graph Mapper or OGM provides a developer-friendly workflow that allows for writing object-oriented notation to communicate with graph databases. Instead of writing Cypher queries, you will be able to write object-oriented code, which the OGM will automatically translate into Cypher queries.

Installation

Prerequisites

[!WARNING]
Python 3.11 users: On Windows, GQLAlchemy is not yet compatible with this Python version. Linux users can install GQLAlchemy without the DGL extra (due to its dependencies not supporting Python 3.11 yet). If this is currently a blocker for you, please let us know by opening an issue.

Install GQLAlchemy

After you’ve installed the prerequisites, run the following command to install GQLAlchemy:

pip install gqlalchemy

With the above command, you get the default GQLAlchemy installation which doesn’t include import/export support for certain formats (see below). To get additional import/export capabilities, use one of the following install options:

pip install gqlalchemy[arrow] # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats
pip install gqlalchemy[dgl] # DGL support (also includes torch)
pip install gqlalchemy[docker] # Docker support

pip install gqlalchemy[all] # All of the above

If you intend to use GQLAlchemy with PyTorch Geometric support, that library must be installed manually:

pip install gqlalchemy[torch_pyg] # prerequisite
pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.13.0+cpu.html"

If you are using the zsh terminal, surround gqlalchemy[$extras] with quotes:

pip install 'gqlalchemy[arrow]'

If you are using Conda for Python environment management, you can install GQLAlchemy through pip.

Build & Test

The project uses Poetry to build the library. Clone or download the GQLAlchemy source code locally and run the following command to build it from source with Poetry:

poetry install --all-extras

The poetry install --all-extras command installs GQLAlchemy with all extras (optional dependencies). Alternatively, you can use the -E option to define what extras to install:

poetry install # No extras

poetry install -E arrow # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats
poetry install -E dgl # DGL support (also includes torch)
poetry install -E docker # Docker support

To run the tests, make sure you have an active Memgraph instance, and execute one of the following commands:

poetry run pytest . -k "not slow" # If all extras installed

poetry run pytest . -k "not slow and not extras" # Otherwise

If you’ve installed only certain extras, it’s also possible to run their associated tests:

poetry run pytest . -k "arrow"
poetry run pytest . -k "dgl"
poetry run pytest . -k "docker"

Development (how to build)

poetry run flake8 .
poetry run black .
poetry run pytest . -k "not slow and not extras"

Documentation

The GQLAlchemy documentation is available on GitHub.

The reference guide can be generated from the code by executing:

pip3 install pydoc-markdown
pydoc-markdown

Other parts of the documentation are written and located at docs directory. To test the documentation locally execute:

pip3 install mkdocs
pip3 install mkdocs-material
pip3 install pymdown-extensions
mkdocs serve

License

Copyright (c) 2016-2023 Memgraph Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

gqlalchemy-1.8.0.tar.gz (69.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gqlalchemy-1.8.0-py3-none-any.whl (95.4 kB view details)

Uploaded Python 3

File details

Details for the file gqlalchemy-1.8.0.tar.gz.

File metadata

  • Download URL: gqlalchemy-1.8.0.tar.gz
  • Upload date:
  • Size: 69.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1015-azure

File hashes

Hashes for gqlalchemy-1.8.0.tar.gz
Algorithm Hash digest
SHA256 2957ff05ca6c0e64b76dceff8fe4828f43679ee75824319e11846baebfc63f90
MD5 ce37b7c92a69406f871f3be74f4bd97d
BLAKE2b-256 574a42cd8bd9f55ca5e4b8f94940a51218ced068d54f985e9c3ecd1a2f369adc

See more details on using hashes here.

File details

Details for the file gqlalchemy-1.8.0-py3-none-any.whl.

File metadata

  • Download URL: gqlalchemy-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 95.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1015-azure

File hashes

Hashes for gqlalchemy-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fd746f766b766ad506c25b964899c33366d1bad865ec1c3c5fa1b48c22658a7
MD5 9c899e88be8e8ae84dd537929877e4c0
BLAKE2b-256 38e303bfba54907b8f10e872d14158f586a58e894506cde7fca6e9585339610d

See more details on using hashes here.

Supported by

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