Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create property graph if not exists #185

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion duckdb
68 changes: 68 additions & 0 deletions test/sql/create_pg/create_if_not_exists.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@


require duckpgq

statement ok
CREATE TABLE Student(id BIGINT, name VARCHAR);

statement ok
CREATE TABLE know(src BIGINT, dst BIGINT, createDate BIGINT);

statement ok
CREATE TABLE School(school_name VARCHAR, school_id BIGINT, school_kind BIGINT);

statement ok
INSERT INTO Student VALUES (0, 'Daniel'), (1, 'Tavneet'), (2, 'Gabor'), (3, 'Peter');

statement ok
INSERT INTO know VALUES (0,1, 10), (0,2, 11), (0,3, 12), (1,2, 14), (1,3, 15), (2,3, 16);

statement ok
-CREATE PROPERTY GRAPH IF NOT EXISTS pg_all_properties
VERTEX TABLES (
Student,
School LABEL School IN School_kind (Hogeschool, University)
)
EDGE TABLES (
know SOURCE KEY ( src ) REFERENCES Student ( id )
DESTINATION KEY ( dst ) REFERENCES Student ( id )
LABEL Knows
)

query I
select count(*) from __duckpgq_internal where is_vertex_table;
----
2

statement ok
-CREATE PROPERTY GRAPH IF NOT EXISTS pg_all_properties
VERTEX TABLES (
Student
)
EDGE TABLES (
know SOURCE KEY ( src ) REFERENCES Student ( id )
DESTINATION KEY ( dst ) REFERENCES Student ( id )
LABEL Knows
)

query I
select count(*) from __duckpgq_internal where is_vertex_table;
----
2

statement ok
-CREATE PROPERTY GRAPH IF NOT EXISTS snb
VERTEX TABLES (
Student
)
EDGE TABLES (
know SOURCE KEY ( src ) REFERENCES Student ( id )
DESTINATION KEY ( dst ) REFERENCES Student ( id )
LABEL Knows
)

query I
select distinct property_graph from __duckpgq_internal order by property_graph desc;
----
snb
pg_all_properties
Loading