cypher-dsl ========== .. meta:: :description: Starts with building and rendering a statement and points to the page for the next task Build Cypher queries as Python syntax objects and render them to Cypher text plus parameters. The library covers a read and write subset of Cypher 5, plus the Cypher 25 syntax it models. :doc:`support` lists exactly which cheat-sheet features it covers and which it does not. It does not connect to a database, so building a :ref:`statement ` and executing it stay separate concerns. .. code-block:: python from cypher_dsl import Configuration, Renderer, match, node, param movie = node("Movie", name="m") statement = ( match(movie) .where(movie["released"] < param("year", 2000)) .returning(movie["title"]) ) renderer = Renderer.get(Configuration(server_version="5.26")) rendered = renderer.render(statement) assert rendered.cypher == ( "MATCH (m:Movie) WHERE m.released < $year RETURN m.title" ) assert rendered.parameters == {"year": 2000} Rendering does not change the statement, and every render returns its own parameter dictionary: changing one result's dictionary leaves the statement and other results alone. To reuse one query with different request values, build the parameter with ``param(name)`` and no value. The render reports it under ``unbound_parameters``, and the code that runs the query supplies the value. Request data goes through ``param()`` and never through string interpolation. .. toctree:: :maxdepth: 2 :caption: Guide getting-started support patterns reading writing composing subqueries procedures parameters targets running .. toctree:: :maxdepth: 2 :caption: Optional add-on model .. toctree:: :maxdepth: 2 :caption: Reference errors api