Create property graph

Creating a property graph as a layer on top of your data is the first step in using SQL/PGQ. In DuckPGQ, property graphs are transient, they only exist as long as the connection to the database is open.

The tables will be split into vertex tables and edge tables, having a primary key-foreign key relationship. An edge table should have a column defining the source node and a column defining the destination node.

To create a property graph the syntax is as follows:

CREATE [ OR REPLACE ] PROPERTY GRAPH (<property_graph_name> 
VERTEX TABLES (
	<vertex table>
[, <vertex table> ]
)
[ EDGE TABLES (	
	<edge table> 
[, <edge table ] ) ];

At least one <vertex table> needs to be specified to create a valid property graph. The EDGE TABLES are optional.

Vertex table

<table name> [ AS <table name alias> ] [ <[properties](<https://duckpgq.notion.site/Property-graph-05c1dffe3f2547f0abfa3ea5a2b4eae1>)> ] [ LABEL <[label](<https://duckpgq.notion.site/Property-graph-05c1dffe3f2547f0abfa3ea5a2b4eae1>)> ] 

For the vertex table, only the name of the table it is a reference to is required. The table name alias, properties, and label are optional.

Edge table

<aside> ⚠️ Under construction

</aside>

Inheritance

<aside> ⚠️ Under construction

</aside>

Properties

Properties can be used to restrict the number of columns that can be used in a SQL/PGQ query.

The specifications allow several options: