CSV data file format
This topic describes the Comma-Separated Values (CSV) data file format for importing data into a Graph Database (GDB) instance.
Background information
CSV data files follow the RFC 4180 specification. For more information, see Common Format and MIME Type for Comma-Separated Values (CSV) Files.
All files must be encoded in UTF-8 format.
Usage notes
Place vertices and edges in separate files.
NoteThe loader can load multiple vertex files and multiple edge files in a single load task.
For each load task, all files to be loaded must be in the same folder of a bucket. You cannot use file names or file name extensions to distinguish vertex files from edge files.
Each file must contain a header row. This row consists of comma-separated system and property column headings.
The header row is the first row of the data file and ends with
\nor\r\n. The row does not support special characters such as double quotation marks and line feeds. All characters except the comma (,) separator are parsed as header content.
System column headings
Header type | Parameter/Syntax | Required | Description |
Point Title |
| Yes | The ID of the vertex. |
| Yes | The label of the vertex. Only a single label is supported. | |
Edge header |
| Yes | The ID of the edge. |
| Yes | The ID of the source vertex. | |
| Yes | The ID of the destination vertex. | |
| Yes | The label of the edge. Only a single label is supported. |
Property column headings
To specify an attribute column for a regular property, use the following syntax. The type name is case-insensitive.
propertyname:typeImportantColumn headings cannot contain spaces. Therefore, property names cannot contain spaces.
Properties do not support the List data type. A property can have only one value.
Example: Specify the column heading for a property named
ageof theInttype.Each row in the file must have an integer value in this column or be left empty.
age:IntTo specify an attribute column for a SET property, use one of the following syntaxes.
ImportantIn Graph Database (GDB), only vertices support SET properties. Edges do not support SET properties. An error occurs if you set a SET property for an edge.
# Compatible with the default format for regular single-value properties. propertyname:type # Regular single-value property. propertyname:type(single) # SET property. The data row contains a single value. propertyname:type(set) # SET property. The data row contains multiple values. propertyname:type[] # SET property. The data row contains multiple values. propertyname:type(set)[]
Row format
Item | Description |
Separators | Fields in a row are separated by commas. Rows are separated by line feeds ( |
Blank fields | Blank fields are allowed for non-required columns, such as user-defined properties. Blank fields still require comma separators. |
Vertex ID | The |
Edge ID | The |
Labels | Labels are case-sensitive strings. |
String values | Quotation marks are optional. If a string contains special characters such as commas, you must enclose the string in double quotation marks (""). |
| SET property field. This indicates that the data field is a property value of the Important When you overwrite a SET property, a property value is appended. If the original property is a regular property, it becomes a SET property after the update. |
| SET property field. This indicates that the data field is an array of property values for the |
Property overwrite logic
Original property logic | New property logic | Result |
Regular property | Regular property | The original property value is overwritten. The last written value is retained. |
Regular property | SET property | The property is updated to a SET property. The original property value is merged as a value in the SET. |
SET property | SET property | The SET property is appended. The property values are the union of the old and new values. |
SET property | Regular property | The property is updated to a regular property. The property value is the last written value. |
CSV file format specifications
The format specifications for SET properties are as follows:
Single-value field for a SET property: The format is the same as the original parsing format. The parsed value is treated as a single element of the SET property.
Array field for a SET property: Use semicolons (;) to separate array elements. For example, an integer array field can be
32;45;12.Array field for a SET property: You can enclose the entire field in double quotation marks (""). The double quotation marks at the beginning and end of the field are removed during parsing. For example, an integer array field can be
"32;45;12".If an array field for a SET property is a string, an array element cannot contain a semicolon (;) because semicolons are parsed as element separators.
Data types
Property value type | Field type | Value range |
Bool or Boolean | Boolean |
|
Integer | char | -128 to 127 |
short | -32768 to 32767 | |
int | -2^31 to 2^31 - 1 | |
long | -2^63 to 2^63 - 1 | |
Decimal Note Decimal notation or scientific notation is supported. (+/-)INFINITY or NaN is not supported. | float | 32-bit IEEE 754 floating-point |
double | 64-bit IEEE 754 floating-point | |
String | string |
|
General examples
Graph Database (GDB) data file (TinkerPop modern graph)

The CSV data files are as follows:
Dotfile
~id
~label
name:string
lang:string
age:int
1
person
marko
29
2
person
vadas
27
3
software
lop
java
4
person
josh
32
5
software
ripple
java
6
person
peter
35
Edge file
~id
~from
~to
~label
weight:double
7
1
2
knows
0.5
8
1
4
knows
1.0
9
1
3
created
0.4
10
4
5
created
1.0
11
4
3
created
0.4
12
6
3
created
0.2
SET property examples
CSV data file
~id | ~label | fruits:string(set)[] | codes:long(set)[] |
1 | person | apple;pear | 22 |
2 | person | banana;bitterorange | 25;81 |
3 | person | "cherry;blackberry;grape" | 3;12 |
4 | person | "54;11" |