INSERT INTO Statement
The INSERT INTO
command allows you to insert one or multiple records into
vertices, edges, or object stores in the graph database.
Overview
INSERT INTO
is a command that allows you to insert the query result into
- flavius vertex/edge tables
- object stores
INSERT INTO Vertex/Edge Table
Syntax
INSERT INTO <vertex/edge>
-- Optionally specify the insert properties
( PROPERTYES ( ... ) )
-- Insertion options:
{
MATCH ...
}
Properties for insert vertex:
Key | Description | Value |
---|---|---|
duplicate_vertex_handling | Indicates how to handle the case insert data has duplicated vertex. | "fail" : Fail the query. "overwrite" : overwrite the vertex value. "ignore" : ignore this vertex(default) |
log_problematic_lines | True on log the records that has problems. | "true" : log the records. "false" : do not log the records(Default). |
Properties for insert edge:
Key | Description | Value |
---|---|---|
incident_vertex_not_exists_handling | Indicateshow to handle cases where the edge endpoint vertex does not exist. | "fail" : Fail the query. "ignore" : Ignore the edge(Default). |
log_problematic_lines | True on log the records that has problems. | "true" : log the records. "false" : do not log the records(Default). |
Examples
Insert vertex
INSERT INTO Person2 PROPERTIES (duplicate_vertex_handling = "ignore", log_problematic_lines = "true")
MATCH (n:Person) RETURN n.col1, n.col2, n.col3
Insert edge
INSERT INTO Knows2 PROPERTIES (incident_vertex_not_exists_handling = "fail", log_problematic_lines = "true")
MATCH (a:Person)-[r:Knows]->(b:Person) RETURN a.col1, b.col1, r.col1
INSERT INTO Object Store
Insert one or mutiple record into a object store.
Syntax
INSERT INTO FILES(
-- Optionally specify the insert properties
<key> = <value>,
...
)
{
MATCH ...
}
For local files, the valid key and values are :
Key | Description | Value |
---|---|---|
PATH | path to export to, should starts with file:// | String, e.g. “file://a/b/c |
FORMAT | file format | String, avaialbe values: "PARQUET" . |
For s3 files, the valid key and values are :
Key | Description | Value |
---|---|---|
PATH | path to export to, should starts with s3:// | String, e.g. “s3://a/b/c |
REGION | s3 region to export to | String |
ACCESS_KEY_ID | s3 access key id | String |
SECRET_ACCESS_KEY | s3 secret access key | String |
FORMAT | file format | String, avaialbe values: "PARQUET" . |
For oss files, the valid key and values are :
Key | Description | Value |
---|---|---|
PATH | path to export to, should starts with oss:// | String, e.g. “oss://a/b/c |
REGION | oss region to export to | String |
ACCESS_KEY_ID | oss access key id | String |
SECRET_ACCESS_KEY | oss secret access key | String |
ENDPOINT | oss endpoint | String, e.g. “https://oss-cn-hongkong.aliyuncs.com ” |
FORMAT | file format | String, avaialbe values: "PARQUET" . |
Last updated on