Expand description
§polars-cypher
Run Cypher queries on a property Graph
stored as Parquet, using Polars.
A graph is written with a GraphWriter, or exported from Neo4j with Export (behind
the neo4j feature). Graph::query then plans a query as a Polars LazyFrame, to
collect or compose further.
use polars_cypher::Graph;
let graph = Graph::open("graph/")?;
let lf = graph
.query("MATCH (p:Person) WHERE p.born < $year RETURN p.name")
.parameter("year", 1970)
.lazy()?;§Cypher
Queries are read-only, of the form MATCH ... [WHERE ...] RETURN ..., supporting:
- One or more comma-separated patterns, with node labels, relationship directions and types
(
:A|B), and inline property maps - Comparisons, arithmetic,
AND/OR/NOT/XOR,IS [NOT] NULL,IN [...], andSTARTS WITH/ENDS WITH/CONTAINS - Parameters (
$x), bound withQueryBuilder::parameter RETURNwith aliases,DISTINCT,ORDER BY,SKIP, andLIMIT- Aggregations (
count,sum,avg,min,max,collect) with implicit grouping - Functions
id,labels,type,coalesce,toUpper,toLower,size, andabs
Variable-length relationships, OPTIONAL MATCH, WITH, UNWIND, and CASE aren’t
supported yet.
Structs§
- Error
- A failure writing, opening, or querying a graph, with the underlying error as its
sourcewhen there is one. - Export
- Exports every node and relationship from a Neo4j database into a
Graph. - Graph
- A property
Graphstored as a directory of Parquet tables, written by aGraphWriter. - Graph
Writer - Writes a
Graphincrementally, so it needn’t fit in memory. - Manifest
- The tables of a
Graph, as recorded in itsmanifest.json. - NodeId
- The id of a node added to a
GraphWriter, to add relationships between nodes with. - Node
Table - A table of the nodes with a label.
- Property
Schema - A property column in a
NodeTableorRelTable. - Query
Builder - A Cypher query and its bound parameters, built with
Graph::query. - RelTable
- A table of the relationships of a type.
Enums§
- Bound
Parameter - A query parameter value, bound with
QueryBuilder::parameter. - Property
Type - The Polars column type of a property.
- Value
- A property value. Values without an equivalent variant should be converted to
Value::String.
Type Aliases§
- Properties
- The properties of a node or relationship, by name.