KuzuDB Python API
Project description
Kùzu
Kùzu is an in-process property graph database management system (GDBMS) built for query speed and scalability. Kùzu is optimized for handling complex join-heavy analytical workloads on very large graph databases, with the following core feature set:
- Flexible Property Graph Data Model and Cypher query language
- Embeddable, serverless integration into applications
- Columnar disk-based storage
- Columnar sparse row-based (CSR) adjacency list/join indices
- Vectorized and factorized query processor
- Novel and very fast join algorithms
- Multi-core query parallelism
- Serializable ACID transactions
Kùzu is being actively developed at University of Waterloo as a feature-rich and usable GDBMS. Kùzu is available under a permissible license. So try it out and help us make it better! We welcome your feedback and feature requests.
Build
To build from source code, Kùzu requires Cmake(>=3.11), Python 3, and a compiler that supports C++20
.
- Perform a full clean build without tests and benchmark:
make clean && make release
- Perform a full clean build with tests and benchmark (optional):
make clean && make all
- Run tests (optional):
make test
For development, use make debug
to build a non-optimized debug version.
To build in parallel, pass NUM_THREADS
as parameter, e.g., make NUM_THREADS=8
.
After build, our CLI binary kuzu_shell
is available under the directory build/release/tools/shell/
.
Installation
Precompiled binary
Precompiled binary of our latest release can be downloaded here.
Python package
Our Python package can be directly install through pip.
pip install kuzu
For more installation and usage instructions, please refer to our website.
Example
We take tinysnb
as an example graph, which is under dataset/tinysnb
in our source code, and can be downloaded here.
CLI
Start CLI
./build/release/tools/shell/kuzu_shell -i "./test.db"
Schema Definition
kuzu> CREATE NODE TABLE person (ID INt64, fName STRING, gender INT64, isStudent BOOLEAN, isWorker BOOLEAN, age INT64, eyeSight DOUBLE, birthdate DATE, registerTime TIMESTAMP, lastJobDuration interval, workedHours INT64[], usedNames STRING[], courseScoresPerTerm INT64[][], PRIMARY KEY (ID));
kuzu> CREATE REL TABLE knows (FROM person TO person, date DATE, meetTime TIMESTAMP, validInterval INTERVAL, comments STRING[], MANY_MANY);
Data Import
kuzu> COPY person FROM "dataset/tinysnb/vPerson.csv" (HEADER=true);
kuzu> COPY knows FROM "dataset/tinysnb/eKnows.csv";
After creating node/rel tables, and importing csv files, you can now run queries!
kuzu> MATCH (b:person)<-[e1:knows]-(a:person)-[e2:knows]->(c:person) RETURN COUNT(*);
Python
import kuzu
db = kuzu.database('./testpy')
conn = kuzu.connection(db)
conn.execute("CREATE NODE TABLE person (ID INt64, fName STRING, gender INT64, isStudent BOOLEAN, isWorker BOOLEAN, age INT64, eyeSight DOUBLE, birthdate DATE, registerTime TIMESTAMP, lastJobDuration interval, workedHours INT64[], usedNames STRING[], courseScoresPerTerm INT64[][], PRIMARY KEY (ID));")
conn.execute("CREATE REL TABLE knows (FROM person TO person, date DATE, meetTime TIMESTAMP, validInterval INTERVAL, comments STRING[], MANY_MANY);")
conn.execute("COPY person FROM 'dataset/tinysnb/vPerson.csv' (HEADER=true);")
conn.execute("COPY knows FROM 'dataset/tinysnb/eKnows.csv';")
result = conn.execute("MATCH (b:person)<-[e1:knows]-(a:person)-[e2:knows]->(c:person) RETURN COUNT(*)")
while result.hasNext():
print(result.getNext())
Refer to our Data Import and Cypher section for more information.
Contributing
We welcome contributions to Kùzu. If you are interested in contributing to Kùzu, please read our Contributing Guide.
License
By contributing to Kùzu, you agree that your contributions will be licensed under the MIT License.
Citing Kùzu
If you are a researcher and use Kùzu in your work, we encourage you to cite our work. You can use the following BibTeX citation:
@inproceedings{kuzu:cidr,
author = {Xiyang Feng and
Guodong Jin and
Ziyi Chen and
Chang Liu and
Semih Saliho\u{g}lu},
title={K\`uzu Graph Database Management System},
booktitle={CIDR},
year={2023}
}
@misc{kuzu-github,
author = {Xiyang Feng and
Guodong Jin and
Ziyi Chen and
Chang Liu and
Semih Saliho\u{g}lu},
title = {{K\`uzu Database Management System Source Code}},
howpublished = {\url{https://github.com/kuzudb/kuzu}},
month = nov,
year = 2022
}
Contact Us
You can contact us at contact@kuzudb.com or join our Slack workspace.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for kuzu-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee6283a93b3d0615b4ef68cfa49c8325063a631b5d005de0360d401cff6709b4 |
|
MD5 | e20cea033cdd7eda978b43d5d859e5f8 |
|
BLAKE2b-256 | 869163f82c6db342debd381e6f75a75769069135c49db8446f0a30c8cd6072a8 |
Hashes for kuzu-0.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b15bbe4f42ca878e7789e05e16413f69133bd50879f63c7bc244c640ed6afca |
|
MD5 | 9b7b4e438bc5900f45591dbaa873ad48 |
|
BLAKE2b-256 | fb08df0b04413bf9c1f25c6a278afe601425d87e2a92ef41e228c865f3564c91 |
Hashes for kuzu-0.0.2-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9aab36f4ddc7f2cb88a44b212a697b34c48d4f920972afaf2695ebb97d1c4537 |
|
MD5 | 56141b1f4df5587c40894b80b49c69d2 |
|
BLAKE2b-256 | 0e58aedcbcded283d1cf9fd5e588c82626d89e018a42e1928983d56e0e121ddc |
Hashes for kuzu-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8793cd2e7ad8fa4b5e11afe733166548f35d8979864a1f5985ad16d33b2fbd8 |
|
MD5 | 1f509bc61f2da168d643e314049782bf |
|
BLAKE2b-256 | bb9aedfad7275c362ac3a154ef093e375afd15eaaa21a5d52a1fef8363d9b525 |
Hashes for kuzu-0.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7365200633bad4509dbddce36007fcc9fa094b8cc5d35a6d61a129a88cd8de02 |
|
MD5 | b89a56cc48a67897dcdb60049158cc0b |
|
BLAKE2b-256 | 3da8c161013e79ae4e59ba66020c4ada3372944271937547e608fca0d69dc254 |
Hashes for kuzu-0.0.2-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b737564bdc2deb7570356e862d55ad1564a3079a7de336c0659ab80798736a6 |
|
MD5 | 215b9e9a95a90808f653b5820578d1ab |
|
BLAKE2b-256 | edd4d20a20f8fdc53e3c08f673095416e3ab40e661ad10cfe23851b5867391e9 |
Hashes for kuzu-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e19f0f1c0799cb23cf666b8b389b34b2cd9dc9b508d87327c6e58dc9868b7fe6 |
|
MD5 | 6829a9ba178ceca8b234e39e701990db |
|
BLAKE2b-256 | c23a7a1b6e6938912a9a1a91a566d22f7a12bde19cfb0f9c5d121d698922f5e8 |
Hashes for kuzu-0.0.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e86dd98d2f313bd777c6a09f4873143f00ead6830dec08acd2ebeee9a5ca0f8 |
|
MD5 | c7e067b22b956d33ecd580476742ec77 |
|
BLAKE2b-256 | 3d7ad0c7790fc7819c80311adecb138eec8dfbfa43155f887dc659237ff30665 |
Hashes for kuzu-0.0.2-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1326beb2167949b7f256966a3479adc2a354a0385aada08e7523cd0ae19888c2 |
|
MD5 | 71b48984803d835475c5c75ef6406091 |
|
BLAKE2b-256 | 836484fbf5a413e175a60e5680b804d853b607d50875cda9f3ae6affb110c109 |
Hashes for kuzu-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eaa2f8c590df9c6e5b454fb3dc458cf75178b2fab2cd2e4802b276b674579f9 |
|
MD5 | 9bc06ff121fed16aca7da13aef874552 |
|
BLAKE2b-256 | e7fc61cc978c1b2a9f3911b1c3e9730396d4974e656c0a2051d52e4eef59b351 |
Hashes for kuzu-0.0.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 899731665564f83898bde9cf957d7eedd769001da0e0af507c86a46ac495a08f |
|
MD5 | e9dbdf74b67784be150ae7ffb5eeddad |
|
BLAKE2b-256 | d3b3202d7552aa913ad1796c6e2ede311e8ea05b4e61a0c646a0db7417ad2094 |
Hashes for kuzu-0.0.2-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03912ed3ab190207e2171e13442566f266dec8107d8554e8e81c6da086ee8252 |
|
MD5 | 9157f31563c4a56839ccec008fa0c754 |
|
BLAKE2b-256 | 76071baaa90f96f050eab71f68aa1b98315cab176cbf6f7b3af39c8560b1ea03 |
Hashes for kuzu-0.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b063bf25e3ab78b9db52b1b77e3304a526b0660783cdc18235a1e95a69083e55 |
|
MD5 | 11741755ee186a0282b12d3425b12ea4 |
|
BLAKE2b-256 | 775e06799ecb024cbde32cb83a0550dcff991489216bb5e56c1cc7b70300ff1a |
Hashes for kuzu-0.0.2-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e7c75a950374b44974033c73f87658455c1182064cacd84d9302611acd5330a |
|
MD5 | 2b23b21a63016f022d06627031882374 |
|
BLAKE2b-256 | eebe865a3aa4b47dff6ca31134ee5c9c18cb2b26cb171a335529880362fd341d |