Skip to main content

Psycopg2 type extension module for AgensGraph

Project description

AgensGraph Python Driver

AgensGraph Python Driver allows Python programs to connect to an AgensGraph database. Since it is Psycopg2 type extension module for AgensGraph, it supports additional data types such as Vertex, Edge, and Path to represent graph data.

Features

  • Cypher query support for Psycopg2 PostgreSQL Python driver (enables cypher queries directly)
  • Deserialize AgensGraph results (AGType) to Vertex, Edge, Path

Install for PYPI

pip install agensgraph-python

Build From Source

git clone https://github.com/skaiworldwide-oss/agensgraph-python
cd agensgraph-python
python setup.py install

Example

import psycopg2
import agensgraph

conn = psycopg2.connect("dbname=test host=127.0.0.1 user=agens")
cur = conn.cursor()
cur.execute("DROP GRAPH IF EXISTS t CASCADE")
cur.execute("CREATE GRAPH t")
cur.execute("SET graph_path = t")

cur.execute("CREATE (:v {name: 'AgensGraph'})")
conn.commit()

cur.execute("MATCH (n) RETURN n")
v = cur.fetchone()[0]
print(v.props['name'])

Test

You may run the following command to test AgensGraph Python Driver.

python setup.py test

Before running the command, set the following environment variables to specify which database you will use for the test.

Variable Name Meaning
AGENSGRAPH_TESTDB database name to connect to
AGENSGRAPH_TESTDB_HOST database server host
AGENSGRAPH_TESTDB_PORT database server port
AGENSGRAPH_TESTDB_USER database user name
AGENSGRAPH_TESTDB_PASSWORD user password

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

agensgraph_python-1.0.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

agensgraph_python-1.0.2-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file agensgraph_python-1.0.2.tar.gz.

File metadata

  • Download URL: agensgraph_python-1.0.2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agensgraph_python-1.0.2.tar.gz
Algorithm Hash digest
SHA256 4b867fd4161ce0e7951f189452bce32b3cceba1c7972410eb98e4987b210c35b
MD5 c52a3ca929f10962d53eabac7255545d
BLAKE2b-256 0705920571b845431e60c7ce0c63a8fb4d359c58b326768c4085cc270a5d167f

See more details on using hashes here.

File details

Details for the file agensgraph_python-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for agensgraph_python-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b245eaa203837815ae7adbdbfe3641a3891450bb143555698e02d201e41d6791
MD5 cb7d3d69af3fae3d320706f3074d7f5b
BLAKE2b-256 faed6684076231866f7ad15de10fcae6f75b715a7c5cb73cb6f37c1e2e24b460

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