duckdb_engine
duckdb_engine copied to clipboard
creating and querying property graphs
The duckpgq plugin implements property graphs in duckDB:
https://duckpgq.org/documentation/sql_pgq/
As Property graphs were introduced in SQL:2023, more databases are starting to implement it.
Here's some SQL showing Property graphs in duckDB:
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 WHERE a.firstName = 'Jan')-[k:Knows]->(b:Person)
COLUMNS (b.firstName)
);
I'm curious if I can use this driver to write a more "SQLAlchemy native" version of the above SQL? Any tips and hints would be really appreciated!