Skip to main content

Dict2Cypher

Convert Python dicts into Neo4j Cypher queries easily and safely.

This library allows you to build Cypher queries from Python dictionaries and lists without ever executing them. Perfect for generating, testing, and templating Neo4j queries.

Features

  • Create, Merge, Delete nodes and relationships
  • Match complex paths
  • Bulk operations
  • Traversals with depth
  • WHERE and filters as strings
  • Auto-generated or custom aliases
  • Indexes and constraints generation
  • Only string output, no Neo4j execution

Installation

pip install dict2cypher

Usage

from dict2cypher import Dict2Cypher

# Simple MATCH
q = Dict2Cypher.match({"Person#p": {"name": "Alice"}}).return_("p")
print(q.cypher())
# MATCH (p:Person {name: 'Alice'}) RETURN p

# Create Node + Relationship
nodes = [{"Person#p": {"name": "Alice"}}, {"Person#q": {"name": "Bob"}}]
rel = {"KNOWS#k": {"from": "p", "to": "q", "since": 2020}}
q = Dict2Cypher.create(nodes + [rel])
print(q.cypher())
# CREATE (p:Person {name: 'Alice'})
# CREATE (q:Person {name: 'Bob'})
# CREATE (p)-[k:KNOWS {since: 2020}]->(q)

Why Use Dict2Cypher?

  • Generates Cypher queries safely from Python structures
  • Works with complex paths, relationships, and filters
  • Useful for testing, templating, or building query builders
  • Keeps your logic in Python, Cypher as pure output

Metadata

Release files for dict2cypher 23

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

Source distribution (sdist)

Source distribution for dict2cypher 23
File Size Uploaded
dict2cypher-23.tar.gz 4.1 kB Details

Built distribution (wheel)

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

Total release size: 7.9 kB

Release files / dict2cypher-23.tar.gz

Download URL dict2cypher-23.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bb89a2dc0f8dbdb5e579dcebdb10f70d78a3514c2457b525888479868c2ba95c
BLAKE2b-256 checksum
How to use checksums
6500191041983a9f3af773683fe842e0cb0fa3ef5fe1c2fdb05ff79b73b5e079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release files / dict2cypher-23-py3-none-any.whl

Download URL dict2cypher-23-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a60e65de3a2611e28186729dea0e38a86c5389273ae09cd049743bd2e371435
BLAKE2b-256 checksum
How to use checksums
29764950fd0f94fb6af554af3cb1b7f26ef26f6a9291b9187b2211d43da8d3e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

23 This release

2 release files

22

2 release files

21

2 release files

20

2 release files

0.11

2 release files

0.1

3 release files

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