Skip to Content

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:

KeyDescriptionValue
duplicate_vertex_handlingIndicates 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_linesTrue on log the records that has problems."true": log the records. "false": do not log the records(Default).

Properties for insert edge:

KeyDescriptionValue
incident_vertex_not_exists_handlingIndicateshow to handle cases where the edge endpoint vertex does not exist."fail": Fail the query. "ignore": Ignore the edge(Default).
log_problematic_linesTrue 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 :

KeyDescriptionValue
PATHpath to export to, should starts with file://String, e.g. “file://a/b/c
FORMATfile formatString, avaialbe values: "PARQUET".

For s3 files, the valid key and values are :

KeyDescriptionValue
PATHpath to export to, should starts with s3://String, e.g. “s3://a/b/c
REGIONs3 region to export toString
ACCESS_KEY_IDs3 access key idString
SECRET_ACCESS_KEYs3 secret access keyString
FORMATfile formatString, avaialbe values: "PARQUET".

For oss files, the valid key and values are :

KeyDescriptionValue
PATHpath to export to, should starts with oss://String, e.g. “oss://a/b/c
REGIONoss region to export toString
ACCESS_KEY_IDoss access key idString
SECRET_ACCESS_KEYoss secret access keyString
ENDPOINToss endpointString, e.g. “https://oss-cn-hongkong.aliyuncs.com
FORMATfile formatString, avaialbe values: "PARQUET".
Last updated on