<table> is the Data 360 object, such as ssot__Individual__dlm. It can also be a CTE or a parenthesized subquery when you need a filtered subset of records.
AS <alias> gives the element a new name. The REFERENCES clause in an edge table definition uses the alias, not the original table name.
KEY identifies each record. Use the object’s ID field. A key can list more than one field when one field isn’t unique. The listed fields must exist on the source and be distinct.
LABEL is the name you use later in MATCH, such as individual or product. More than one table can use the same label. Repeat LABEL on the same table to give that table more than one label. Each LABEL on a table can list its own properties. If you omit LABEL, Data 360 SQL uses the table alias, or name if no alias is given.
SOURCE KEY is the field that points to the starting vertex. In the commerce graph, ssot__SoldToCustomerId__c points to the customer, and ssot__SalesOrderId__c points to the order.
DESTINATION KEY is the field that points to the ending vertex. ssot__Id__c on the Sales Order points to that order vertex, and ssot__ProductId__c points to the product.
The number of source or destination fields must match the referenced vertex key, and the types must be comparable. The optional column list after REFERENCES maps those fields to vertex key fields by position. The listed fields must be key columns of that vertex. If you omit the list, Data 360 SQL uses the vertex key in declared order.
If an edge’s source or destination is NULL or doesn’t match a vertex, Data 360 SQL leaves that edge out of the results. That isn’t an error.
Properties
1PROPERTIES (<expression>[AS <property>][, ...])2PROPERTIES ARE ALL COLUMNS3PROPERTIES ALL COLUMNS EXCEPT(<column>[, ...])4NO PROPERTIES
Start with an explicit list of the fields you need, and give them short names such as name or quantity. Later queries use those property names, not the original ssot__... field names.
When you want every field, use PROPERTIES ARE ALL COLUMNS. Use EXCEPT to hide fields you don’t want as properties, or NO PROPERTIES when the table is only a connection. If you expose a field without an alias, MATCH and COLUMNS use the original field name, such as i.ssot__FirstName__c.
Example: An Ecommerce Graph
This graph answers “which products did this customer order?”
1WITH pg AS PROPERTY GRAPH (2 VERTEX TABLES (3 ssot__Individual__dlm AS individuals KEY(ssot__Id__c)4 LABEL individual PROPERTIES (5 ssot__Id__c AS individualId,6 ssot__FirstName__c AS name7),8 ssot__SalesOrder__dlm AS orders KEY(ssot__Id__c)9 LABEL salesOrder PROPERTIES (10 ssot__Id__c AS orderId,11 ssot__Name__c AS name12),13 ssot__GoodsProduct__dlm AS products KEY(ssot__Id__c)14 LABEL product PROPERTIES (15 ssot__Id__c AS productId,16 ssot__Name__c AS name17)18)19 EDGE TABLES (20 ssot__SalesOrder__dlm AS customerOrders KEY(ssot__Id__c)21 SOURCE KEY(ssot__SoldToCustomerId__c)REFERENCES individuals22 DESTINATION KEY(ssot__Id__c)REFERENCES orders23 LABEL customerOrder PROPERTIES (24 ssot__CreatedDate__c AS createdDate25),26 ssot__SalesOrderProduct__dlm AS orderProducts KEY(ssot__Id__c)27 SOURCE KEY(ssot__SalesOrderId__c)REFERENCES orders28 DESTINATION KEY(ssot__ProductId__c)REFERENCES products29 LABEL orderProduct PROPERTIES (30 ssot__CreatedDate__c AS createdDate,31 ssot__OrderedQuantity__c AS quantity32)33)34)35SELECT * FROM GRAPH_TABLE(pg36 MATCH(i:individual)-[:customerOrder]->(:salesOrder)37 -[line:orderProduct]->(product:product)38 COLUMNS (i.name AS individualName, product.name AS productName,39 line.createdDate, line.quantity)40)AS g;
Read the MATCH clause as a walk: start at a customer, follow the order they placed, then follow the line item to the product.
Expose Every Field (or Hide Some)
Use PROPERTIES ARE ALL COLUMNS when you want every field. Use EXCEPT to hide IDs. Use NO PROPERTIES when the table is only a connection. Fields exposed without aliases keep their original names, such as i.ssot__FirstName__c.
1WITH pg AS PROPERTY GRAPH (2 VERTEX TABLES (3 ssot__Individual__dlm AS individuals KEY(ssot__Id__c)4 LABEL individual PROPERTIES ARE ALL COLUMNS,5 ssot__SalesOrder__dlm AS orders KEY(ssot__Id__c)6 LABEL salesOrder PROPERTIES ALL COLUMNS EXCEPT(ssot__Id__c),7 ssot__GoodsProduct__dlm AS products KEY(ssot__Id__c)8 LABEL product PROPERTIES ALL COLUMNS EXCEPT(ssot__Id__c)9)10 EDGE TABLES (11 ssot__SalesOrder__dlm AS customerOrders KEY(ssot__Id__c)12 SOURCE KEY(ssot__SoldToCustomerId__c)REFERENCES individuals13 DESTINATION KEY(ssot__Id__c)REFERENCES orders14 LABEL customerOrder NO PROPERTIES,15 ssot__SalesOrderProduct__dlm AS orderProducts KEY(ssot__Id__c)16 SOURCE KEY(ssot__SalesOrderId__c)REFERENCES orders17 DESTINATION KEY(ssot__ProductId__c)REFERENCES products18 LABEL orderProduct PROPERTIES (ssot__OrderedQuantity__c AS quantity)19)20)21SELECT * FROM GRAPH_TABLE(pg22 MATCH(i:individual)-[:customerOrder]->(:salesOrder)23 -[line:orderProduct]->(product:product)24 COLUMNS (i.ssot__FirstName__c AS individualName,25 product.ssot__Name__c AS productName, line.quantity)26)AS g;