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-21.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

dict2cypher-21-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dict2cypher-21.tar.gz
Algorithm Hash digest
SHA256 e4da59ecab582a151c95cac3e11a66bf969097213d46a5f7d4e3bd83a96203ef
MD5 a8a5d8bd0b33231341e530ecd3665e76
BLAKE2b-256 a6c177e1452cc9d08868ba1cf04df2e7ec30690ae592b263138af79d40173d9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dict2cypher-21-py3-none-any.whl
  • Upload date:
  • Size: 3.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-21-py3-none-any.whl
Algorithm Hash digest
SHA256 3149a640d8efc81193591a4c343dede38c49cc4eb70ca7a5a13929e350250cc8
MD5 a86fe38a75a5128dfee8cff73b9af4d4
BLAKE2b-256 56e497972a4ca382fbf0a745c7f2e0c5867ccf5a9da453fa016e715da9f65a92

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