Skip to main content

cypher2sql

CI PyPI Python Docs License

Answer graph questions on the PostgreSQL schema you already have — up to 17.1× faster than Neo4j (median 6.1×), no migration.

Install with pip install cypher2sql, describe your tables and foreign keys once, write Cypher, get one parameterized SQL query that returns the primary keys you asked for.

Documentation · Tutorial · API reference · Performance · openCypher parity

from cypher2sql import Edge, Node, Schema

customer = Node("Customer", table="customer", key="id", properties={"country": str})
order = Node("Order", table="order", key="id", properties={"id": int})
shop = Schema(
    nodes=[customer, order],
    edges=[Edge("PLACED", customer, order, source_columns="customer_id")],
)

q = shop.to_sql(
    "MATCH (c:Customer {country: $country})-[:PLACED]->(:Order) RETURN c",
    {"country": "FR"},
)
print(q.sql)
print(q.params)
SELECT n1."id"
FROM "customer" AS n1
WHERE n1."country" COLLATE "C" = %s::text
  AND EXISTS (
    SELECT 1
    FROM "order" AS n2
    WHERE n2."customer_id" = n1."id"
  )
('FR',)

Run it with any driver: conn.execute(q.sql, q.params) (psycopg), or feed it to your ORM. A single-column key fits WHERE id IN (...), a psycopg.sql wrapper still needs your own literal % as %%, and composite keys join a CTE. Compiling never touches the database; on Python ≥ 3.14 a t-string carries its values as {expr} and takes no params dict.

  • Your database stays relational: no graph extension, no data migration, no runtime dependencies.
  • Property values are always bound parameters; a label/type selector only chooses among identifiers from your declared schema.

Start with the tutorial; every name is in the API reference.

Correctness

Correctness is checked on a real PostgreSQL against the official openCypher TCK, vendored in vendor/opencypher-tck/: 220 features, 3,897 scenario instances (1,615 declarations; outlines expand to 3,897). tests/tck/scope.toml classifies every instance and the design records why. make tck prints the live split: its first line is in-scope passing: N / N, out-of-scope: M (by category), then planned: P (must not pass) and one count line per category, including in; N, M and P are the live counts. The vision states that split.

License

Apache-2.0. The vendored openCypher TCK and grammar are Apache-2.0 (see vendor/*/NOTICE).

Metadata

Release files for cypher2sql 0.1.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 cypher2sql 0.1.0
File Size Uploaded Provenance Actions
cypher2sql-0.1.0.tar.gz 436.4 kB With provenance Details for cypher2sql-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 591.8 kB

Release files / cypher2sql-0.1.0.tar.gz

Download URL cypher2sql-0.1.0.tar.gz
Size 436.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c7e89bbcd0cdf07f9c923b89dfb53625762b57498be478c3f50d7536d6515c6c
BLAKE2b-256 checksum
How to use checksums
5030767d74044572c3826445a0f15e02ce38a3a2e874398c0dc230f4920bfd09
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 29, 2026.

Transparency log

Release files / cypher2sql-0.1.0-py3-none-any.whl

Download URL cypher2sql-0.1.0-py3-none-any.whl
Size 155.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16b76ee0a58bc19c042770a44044c84be45d5769868d6c7e07abdda8aad43baf
BLAKE2b-256 checksum
How to use checksums
07203a7c182dd9ef9b7f453aeb10405731d7efa206fccc8bcd4b9e1037aef7f6
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 29, 2026.

Transparency log

Security for cypher2sql 0.1.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 cypher2sql-0.1.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 29, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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