Crate kuzu

source ·
Expand description

Bindings to Kùzu: an in-process property graph database management system built for query speed and scalability.

§Example Usage

use kuzu::{Database, SystemConfig, Connection};

let db = Database::new(path, SystemConfig::default())?;
let conn = Connection::new(&db)?;
conn.query("CREATE NODE TABLE Person(name STRING, age INT64, PRIMARY KEY(name));")?;
conn.query("CREATE (:Person {name: 'Alice', age: 25});")?;
conn.query("CREATE (:Person {name: 'Bob', age: 30});")?;

let mut result = conn.query("MATCH (a:Person) RETURN a.name AS NAME, a.age AS AGE;")?;
println!("{}", result.display());

§Safety

Generally, use of this API is safe - however creating multiple databases in the same scope is not considered safe. If you need to access multiple databases you will need to do so in separate processes.

§Building

By default, the kuzu C++ library will be compiled from source and statically linked. If the kuzu C++ library is not being built using multiple threads by default, you can set the CMAKE_BUILD_PARALLEL_LEVEL environment variable to potentially speed up the build process.

If you want to instead link against a pre-built version of the library, the following environment variables can be used to configure the build process:

  • KUZU_SHARED: If set, link dynamically instead of statically
  • KUZU_INCLUDE_DIR: Directory of kuzu’s headers
  • KUZU_LIBRARY_DIR: Directory containing kuzu’s pre-built libraries.

Structs§

  • Produces an iterator over a QueryResult as RecordBatches
  • Options for writing CSV files
  • Connections are used to interact with a Database instance.
  • The Database class is the main class of KuzuDB. It manages all database components.
  • Stores the table_id and offset of a node/rel.
  • NodeVal represents a node in the graph and stores the nodeID, label and properties of that node.
  • A prepared stattement is a parameterized query which can avoid planning the same query for repeated execution
  • Stores the result of a query execution
  • RelVal represents a relationship in the graph and stores the relID, src/dst nodes and properties of that rel
  • Configuration options for the database.

Enums§

Constants§

  • The version of the Kùzu crate as reported by Cargo’s CARGO_PKG_VERSION environment variable

Functions§