Skip to main content

Convert Python dicts to Neo4j Cypher queries easily

Project description

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

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

dict2cypher-0.1.tar.gz (2.1 kB view details)

Uploaded Source

Built Distributions

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

dict2cypher-0.1.0-py3-none-any.whl (1.2 kB view details)

Uploaded Python 3

dict2cypher-0.1-py3-none-any.whl (1.8 kB view details)

Uploaded Python 3

File details

Details for the file dict2cypher-0.1.tar.gz.

File metadata

  • Download URL: dict2cypher-0.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for dict2cypher-0.1.tar.gz
Algorithm Hash digest
SHA256 d962cd0f08a8c95652c4b8dbfed5f58bc883de93e262a43a78b723c19bd43c73
MD5 255810fc67bd7a2d87b2635b8031f4f3
BLAKE2b-256 c4c4e82d839c10c47866c64599edddc5ddebaba9ff12f08990c479b1a00af671

See more details on using hashes here.

File details

Details for the file dict2cypher-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dict2cypher-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for dict2cypher-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 401fdcac65c6bd75e75f7cb254da521e5b5d6c7cb6157b6ef9270d6f6b5fe267
MD5 ba016d5b0094b5636a7fe0189309e05f
BLAKE2b-256 e76e34a4cc7219845b9f49e82c88ea6a2b8e6b301d63fe8f35e15fa1d9df313e

See more details on using hashes here.

File details

Details for the file dict2cypher-0.1-py3-none-any.whl.

File metadata

  • Download URL: dict2cypher-0.1-py3-none-any.whl
  • Upload date:
  • Size: 1.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for dict2cypher-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b1b34ec8c60c3224c721abe44430192cd544b93865c89185ecca933915d5075
MD5 6e4396eaf49c9cc1d9a7dac7e9096b03
BLAKE2b-256 e97407aa687c00675a218f1c4be85b08d9f86e736c6d2f4a6427660f53f12129

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