Install and load
Run these commands in a Haybarn SQL session. The extension is available from the community repository.
INSTALL duckpgq FROM community;
LOAD duckpgq FROM community;
Try it in a temporary SQL session with duckpgq already loaded. Queries run in this tab; examples using files or services need their own setup.
Using upstream DuckDB? Follow the maintainer’s installation instructions.
Usage example
SET active_grammar_extensions = ['duckpgq'];
CREATE TABLE Person AS SELECT * FROM 'https://gist.githubusercontent.com/Dtenwolde/2b02aebbed3c9638a06fda8ee0088a36/raw/8c4dc551f7344b12eaff2d1438c9da08649d00ec/person-sf0.003.csv';
CREATE TABLE Person_knows_person AS SELECT * FROM 'https://gist.githubusercontent.com/Dtenwolde/81c32c9002d4059c2c3073dbca155275/raw/8b440e810a48dcaa08c07086e493ec0e2ec6b3cb/person_knows_person-sf0.003.csv';
CREATE PROPERTY GRAPH snb
VERTEX TABLES (
Person
)
EDGE TABLES (
Person_knows_person SOURCE KEY (Person1Id) REFERENCES Person (id)
DESTINATION KEY (Person2Id) REFERENCES Person (id)
LABEL knows
);
FROM GRAPH_TABLE (snb
MATCH (a:Person)-[k:knows]->(b:Person)
COLUMNS (a.id, b.id)
)
LIMIT 1;
FROM GRAPH_TABLE (snb
MATCH p = ANY SHORTEST (a:person)-[k:knows]->{1,3}(b:Person)
COLUMNS (a.id, b.id, path_length(p))
)
LIMIT 1;
FROM local_clustering_coefficient(snb, person, knows);
DROP PROPERTY GRAPH snb;
Provided by cwida. Not yet verified on Haybarn 2.0.0.
Sample data & setupAbout this extension
The DuckPGQ extension supports the SQL/PGQ syntax as part of the official SQL:2023 standard developed by ISO.
It introduces visual graph pattern matching and a more concise syntax for path-finding. For more information, please see the DuckPGQ documentation. Note: Starting with DuckDB v2.0, you have to opt in to the DuckPGQ grammar after loading the extension by running SET active_grammar_extensions = ['duckpgq'];. Disclaimer: As this extension is part of an ongoing research project by the Database Architectures group at CWI, some features may still be under development. We appreciate your understanding and patience as we continue to improve it.
Project overview from the community descriptor.
Documentation and resources
Project and build details
- Repository
- cwida/duckpgq-extension
- License
- MIT
- Maintainers
- Dtenwolde
- Written in
- C++
- Build source
9c11bc192a07- Build definition
- Community descriptor