Configure GDB Writer on the DataWorks platform
This topic describes the parameters supported by GDB Writer, such as data types, field mapping, and data sources, and provides configuration examples.
- GDB Writer supports only exclusive resource groups for Data Integration. It does not support default resource groups or custom resource groups.
- Before you configure the GDB Writer plugin, you must configure the data source. For more information, see Configure a Graph Database data source.
- The configuration for data integration tasks is different for vertices and edges. You must configure these tasks separately.
Usage notes
- Run the synchronization task for vertices first. After the vertex task is successful, run the synchronization task for edges.
- Constraints on vertices:
- A vertex must have a type name, which corresponds to the label.
- A vertex must have a primary key ID. The ID must be of the string type and unique among all vertices. If the ID is not a string, the GDB Writer plugin forcibly converts it to a string.
- Be cautious when you set the `idTransRule` parameter for the primary key of a vertex. If you set this parameter to `None`, you must ensure that the vertex ID is unique among all global vertices.
- Constraints on edges:
- An edge must have a type name, which corresponds to the label.
- The primary key ID is optional for an edge:
- If specified, the value must be unique across the global edge.
- If you do not specify a primary key ID, the GDB server generates a universally unique identifier (UUID) by default. The UUID must be of the string type. If the UUID is not a string, the GDB Writer plugin forcibly converts it.
- Be cautious when you set the `idTransRule` parameter for the primary key of an edge. If you set this parameter to `None`, you must ensure that the edge ID is unique among all global vertices and edges.
- You must specify the `srcIdTransRule` and `dstIdTransRule` parameters for an edge. The values of these parameters must match the value of the `idTransRule` parameter that you specified when you imported the vertices.
- Unless otherwise specified, field names and enumerated values in the examples are case-sensitive.
- The GDB server supports only the UTF-8 encoding format. Therefore, your source data must also use the UTF-8 encoding format.
- Due to network limits, you can run data integration tasks only in exclusive resource mode.
Parameter description
| Parameter | Description | Required | Default value |
| datasource | The name of the data source. In the code editor, you can add a data source. The value of this parameter must be the same as the name of the added data source. | Yes | None |
| labelType | The type of data to write. Valid values:
| Yes | None |
| writeMode | The processing mode for duplicate IDs during import. Valid values:
| Yes | INSERT |
| label | The type name, which is the name of the vertex or edge. The label can be read from a source column. For example, | Yes | None |
| srcLabel | The name of the start vertex.
| No | None |
| dstLabel | The name of the end vertex.
| No | None |
| idTransRule | The conversion rule for the primary key ID. Valid values:
| Yes | none |
| srcIdTransRule | The conversion rule for the primary key ID of the start vertex when you write data for an edge. Valid values:
| Required when you write data for an edge. | none |
| dstIdTransRule | The conversion rule for the primary key ID of the end vertex when you write data for an edge. Valid values:
| Required when you write data for an edge. | none |
| column::name | Configures the name field for the field mapping of a vertex or edge. This parameter specifies the name of the vertex or edge field. If the mapping is for a property, this is the property name. | Yes | None |
| column::type | Configures the type field for the field mapping of a vertex or edge. This parameter specifies the data type of the mapped value for the vertex or edge field.
| Yes | None |
| column::value | Configures the value field for the field mapping of a vertex or edge. This parameter specifies the mapped value for the vertex or edge field. Custom concatenation is supported only for string values.
| Yes | None |
| column::columnType | Configures the columnType field for the field mapping of a vertex or edge. This parameter specifies the category of the mapped field. The following enumerated values are supported:
| Yes | None |
{"properties":[
{"k":"name","t":"string","v":"tom"},
{"k":"age","t":"int","v":"20"},
{"k":"sex","t":"string","v":"male"}
]}Introduction to wizard development
Codeless UI development is not currently supported.
Script development
You can configure a data synchronization job to write data to GDB. For more information about how to configure the job in the code editor, see Configure a task in the code editor.
- Vertex configuration example
{ "order":{ "hops":[ { "from":"Reader", "to":"Writer" } ] }, "setting":{ "errorLimit":{ "record":"100" // The maximum number of dirty data records allowed. }, "jvmOption":"", "speed":{ "concurrent":8, // The number of concurrent threads. "throttle":false } }, "steps":[ { "category":"reader", "name":"Reader", "parameter":{ "column":[ "*" ], "datasource":"_ODPS", "emptyAsNull":true, "guid":"", "isCompress":false, "partition":[], "table":"" }, "stepType":"odps" }, { "category":"writer", "name":"Writer", "parameter": { "datasource": "testGDB", // The data source name. "label": "person", // The label name, which is the vertex name. "srcLabel": "", // This field can be ignored for the vertex type. "dstLabel": "", // This field can be ignored for the vertex type. "labelType": "VERTEX", // The label type. "VERTEX" indicates a vertex. "writeMode": "INSERT", // The processing mode for duplicate IDs during import. "idTransRule": "labelPrefix", // The conversion rule for the primary key of the vertex. "srcIdTransRule": "none", // This field can be ignored for the vertex type. "dstIdTransRule": "none", // This field can be ignored for the vertex type. "maxConnectionPoolSize":8, // Set this value to be greater than or equal to `concurrent`. Valid values are 8, 16, 32, and so on. "column": [ { "name": "id", // The field name. "value": "#{0}", // #{0} indicates the value of the first field from the source. Concatenation is supported. 0 is the column index of the source. "type": "string", // The field type. "columnType": "primaryKey" // The field category. primaryKey indicates the primary key. }, // The primary key of the vertex. The field name must be id and the type must be string. This record must exist. { "name": "person_age", "value": "#{1}", // #{1} indicates the value of the second field from the source. Concatenation is supported. "type": "int", "columnType": "vertexProperty" // The field category. vertexProperty indicates a vertex property. }, // A vertex property. Supported types: int, long, float, double, boolean, and string. { "name": "person_credit", "value": "#{2}", // #{2} indicates the value of the third field from the source. Concatenation is supported. "type": "string", "columnType": "vertexProperty" }, // A vertex property. ] } "stepType":"gdb" } ], "type":"job", "version":"2.0" } - Edge configuration example
{ "order":{ "hops":[ { "from":"Reader", "to":"Writer" } ] }, "setting":{ "errorLimit":{ "record":"100" // The maximum number of dirty data records allowed. }, "jvmOption":"", "speed":{ "concurrent":8, "throttle":false } }, "steps":[ { "category":"reader", "name":"Reader", "parameter":{ "column":[ "*" ], "datasource":"_ODPS", "emptyAsNull":true, "guid":"", "isCompress":false, "partition":[], "table":"" }, "stepType":"odps" }, { "category":"writer", "name":"Writer", "parameter": { "datasource": "testGDB", // The data source name. "label": "use", // The label name, which is the edge name. "labelType": "EDGE", // The label type. EDGE indicates an edge. "srcLabel": "person", // The name of the start vertex. "dstLabel": "software", // The name of the end vertex. "writeMode": "INSERT", // The processing mode for duplicate IDs during import. "idTransRule": "labelPrefix", // The conversion rule for the primary key of the edge. "srcIdTransRule": "labelPrefix", // The conversion rule for the primary key of the start vertex. "dstIdTransRule": "labelPrefix", // The conversion rule for the primary key of the end vertex. "maxConnectionPoolSize":8, // Set this value to be greater than or equal to `concurrent`. Valid values are 8, 16, 32, and so on. "column": [ { "name": "id", // The field name. "value": "#{0}", // #{0} indicates the value of the first field from the source. Concatenation is supported. "type": "string", // The field type. "columnType": "primaryKey" // The field category. primaryKey indicates the primary key. }, // The primary key of the edge. The field name must be id and the type must be string. This record is optional. { "name": "id", "value": "#{1}", // Concatenation is supported. Make sure that the mapping rule is consistent with the rule used when you imported the vertex. "type": "string", "columnType": "srcPrimaryKey" // The field category. srcPrimaryKey indicates the primary key of the start vertex. }, // The primary key of the start vertex. The field name must be id and the type must be string. This record must exist. { "name": "id", "value": "#{2}", // Concatenation is supported. Make sure that the mapping rule is consistent with the rule used when you imported the vertex. "type": "string", "columnType": "dstPrimaryKey" // The field category. dstPrimaryKey indicates the primary key of the end vertex. }, // The primary key of the end vertex. The field name must be id and the type must be string. This record must exist. { "name": "person_use_software_time", "value": "#{3}", // Concatenation is supported. "type": "long", "columnType": "edgeProperty" // The field category. edgeProperty indicates an edge property. }, // An edge property. Supported types: int, long, float, double, boolean, and string. { "name": "person_regist_software_name", "value": "#{4}", // Concatenation is supported. "type": "string", "columnType": "edgeProperty" }, // An edge property. { "name": "id", "value": "#{5}", // Concatenation is supported. "type": "long", "columnType": "edgeProperty" }, // An edge property whose field name is id. Unlike the primary key ID, this field is a common property and is optional. ] } "stepType":"gdb" } ], "type":"job", "version":"2.0" }
To use SET properties, you must upgrade your GDB instance to V1.0.20 or later. Confirm your instance version before you use SET properties.