Configure GDB Reader on the DataWorks platform

Updated at:

This topic describes the parameters that GDB Reader supports, data types, field mappings, and data sources. This topic also provides configuration examples.

Note

Usage notes

  • You must separately configure a vertex task and an edge task to export the vertex data and the edge data from Graph Database (GDB).
  • Export tasks traverse data by the vertex or edge type name, which corresponds to the label. Ensure that you provide the correct type name for the data you want to export.
  • The primary key ID fields of vertices and edges in GDB are of the STRING type. The type of data to be exported must be configured as the STRING type. If the configured type is a numeric type, such as LONG, the plug-in converts the type to the specified type. However, if the conversion fails, the record is lost.
  • You must configure the type of property values that are exported from GDB as the data type that GDB supports. If the storage class is different from the configured type, the plug-in converts the storage type to the specified type. However, if the conversion fails, the record is lost.
  • When you export the vertex data multiple times, the obtained values of the SET property may be different.
  • If you export all the properties in JSON format, the SET property that contains only one value is regarded as a common property.
  • Unless otherwise specified, field names or enumerated values in examples are case-sensitive.
  • The GDB server supports only the UTF-8 encoding format and exports all data in UTF-8.
  • Due to network limits, you can use only the exclusive resource mode when you run data integration tasks. For more information about the exclusive resource mode, see Exclusive resource mode.

Parameter description

ParameterDescriptionRequiredDefault value
datasourceThe data source name. It must be the same as the name of the added data source. You can add data sources in the code editor. YesN/A
labelTypeThe type of written data.
  • VERTEX: a vertex.
  • EDGE: an edge.
YesN/A
labelsThe label that is the name of the vertex or the edge. GDB Reader can read data about multiple names that are represented by an array. YesN/A
column::nameSpecify the name field using the vertex or edge mappings.

Specifies the property name and is required when reading a property.

YesN/A
column::typeSpecify the type field using the vertex or edge mappings.
  • Both primary key IDs and labels are of the string type in GDB. If the data type is not string, the conversion may fail.
  • Supported types of common properties are int, long, float, double, boolean, and string
  • GDB Reader converts the read data to the specified type if possible. If the conversion fails, the data record is lost.
YesN/A
column::columnTypeSpecify the columnType field using the field mappings of the vertex or the edge.
This parameter specifies the category of the mapped field for the vertex or edge field. The following enumerated values are supported:
  • primaryKey: the primary key ID.
  • primaryLabel specifies the point or edge name for the field mapping.
  • vertexProperty: the vertex property. This value is optional when vertex data is exported.
  • vertexJsonProperty: a set of vertex properties. The set of vertex properties is encapsulated in JSON format. This value is optional when vertex data is exported. If you select this value, all the vertex properties are packaged in JSON format and stored in this column. the column cannot contain other property types.
  • srcPrimaryKey: the primary key ID of the start vertex. This value is optional when edge data is exported.
  • dstPrimaryKey: the primary key ID of the end vertex. This value is optional when edge data is exported.
  • srcPrimaryLabel: the label of the start vertex. This value is optional when edge data is exported.
  • dstPrimaryLabel: the label of the end vertex. This value is optional when edge data is exported.
  • edgeProperty: the edge property. This value is optional when edge data is exported.
  • edgeJsonProperty: a set of edge properties. The set of edge properties is encapsulated in JSON format. This value is optional when edge data is exported. If you select this value, all the edge properties are packaged in JSON format and stored in this column. the column cannot contain other property types.
Yes N/A
vertexJsonProperty format
{"properties":[
   {"k":"name","t":"string","v":"tom","c":"set"},
   {"k":"name","t":"string","v":"jack","c":"set"},
   {"k":"sex","t":"string","v":"male","c":"single"}
]}
edgeJsonProperty format
{"properties":[
   {"k":"name","t":"string","v":"tom"},
   {"k":"sex","t":"string","v":"male"}
]}
Important
  • Edges do not support the multi-value property. When edge data is encapsulated in JSON format, no c field is available.
  • If the multi-value property of a vertex contains only one property value, the property is processed as the single-value property when the vertex data is exported.

Introduction to Wizard Development

The codeless user interface (UI) mode is not supported.

Introduction to scripting

Configure a task to export data from GDB. For more information about how to configure the task in code editor mode, see Configure a task in code editor mode.

  • Example of vertex configuration
    {
        "order":{
            "hops":[
                {
                    "from":"Reader",
                    "to":"Writer"
                }
            ]
        },
        "setting":{
            "errorLimit":{
                "record":"100"  // The maximum number of dirty data records allowed.
            },
            "jvmOption":"",
            "speed":{
                "concurrent":3,
                "throttle":false
            }
        },
        "steps":[
            {
                "category":"reader",
                "name":"Reader",
                "parameter":{ 
                    "datasource": "testGDB", // The data source name.
                    "labelType": "VERTEX", // The type of the label. VERTEX indicates a vertex.
                    "labels": ["label1", "label2"],  // The labels of the vertices to be exported. If this parameter is left empty, all the vertices are exported.
                    "column": [
                        {
                            "name": "id",               // The name of the field.
                            "type": "string",           // The type of the field.
                            "columnType": "primaryKey"  // The category of the field. primaryKey indicates the primary key ID of the vertex, and is of the STRING type in the GDB instance.
                        },
                        {
                            "name": "label",              // The name of the field.
                            "type": "string",             // The type of the field.
                            "columnType": "primaryLabel"  // The category of the field. primaryLabel indicates the label of the vertex, and is of the STRING type in the GDB instance.
                        },
                        {
                            "name": "age",                   // The field name of the property.
                            "type": "int",                   // The field type of the property.
                            "columnType": "vertexProperty"   // The category of the field. vertexProperty indicates a common vertex property in the GDB instance.
                        }
                    ]
                }
                "stepType":"gdb"
            },
            {
                "category":"writer",
                "name":"Writer",
                "parameter":{  
                    "print":false,          // Specifies whether to display output on the screen.
                    "fieldDelimiter":","    // The column delimiter.
                }
                "stepType":"stream"
            }
        ]
        "type":"job",
        "version":"2.0"
    }
                        
  • {
        "order":{
            "hops":[
                {
                    "from":"Reader",
                    "to":"Writer"
                }
            ]
        },
        "setting":{
            "errorLimit":{
                "record":"100"  // The maximum number of dirty data records allowed.
            },
            "jvmOption":"",
            "speed":{
                "concurrent":3,
                "throttle":false
            }
        },
        "steps":[
            {
                "category":"reader",
                "name":"Reader",
                "parameter":{ 
                    "datasource": "testGDB", // The name of the data source.
                    "labelType": "EDGE", // The type of the label. "EDGE" indicates an edge.
                    "labels": ["label1", "label2"],  // A list of labels for the edges to be exported. If this parameter is left empty, all edges are exported.
                    "column": [
                        {
                            "name": "id",               // The name of the field.
                            "type": "string",           // The type of the field.
                            "columnType": "primaryKey"  // The category of the field. This parameter indicates the primary key ID of the edge. The value is of the STRING type in GDB.
                        },
                        {
                            "name": "label",              // The name of the field.
                            "type": "string",             // The type of the field.
                            "columnType": "primaryLabel"  // The category of the field. This parameter indicates the label of the edge. The value is of the STRING type in GDB.
                        },
                        {
                            "name": "srcId",               // The name of the field.
                            "type": "string",              // The type of the field.
                            "columnType": "srcPrimaryKey"  // The category of the field. This parameter indicates the ID of the start vertex of the edge. The value is of the STRING type in GDB.
                        },
                        {
                            "name": "srcLabel",               // The name of the field.
                            "type": "string",                 // The type of the field.
                            "columnType": "srcPrimaryLabel"   // The category of the field. This parameter indicates the label of the start vertex of the edge. The value is of the STRING type in GDB.
                        },
                        {
                            "name": "dstId",                    // The name of the field.
                            "type": "string",                   // The type of the field.
                            "columnType": "dstPrimaryKey"       // The category of the field. This parameter indicates the ID of the end vertex of the edge. The value is of the STRING type in GDB.
                        },
                        {
                            "name": "dstLabel",                 // The name of the field.
                            "type": "string",                   // The type of the field.
                            "columnType": "dstPrimaryLabel"     // The category of the field. This parameter indicates the label of the end vertex of the edge. The value is of the STRING type in GDB.
                        },
                        {
                            "name": "weight",               // The name of the property field.
                            "type": "double",               // The type of the property field.
                            "columnType": "edgeProperty"    // The category of the field. This parameter indicates an edge property.
                        }
                    ]
                }
                "stepType":"gdb"
            },
            {
                "category":"writer",
                "name":"Writer",
                "parameter":{  
                    "print":false,          // Specifies whether to print the output to the screen.
                    "fieldDelimiter":","    // The column delimiter.
                }
                "stepType":"stream"
            }
        ]
        "type":"job",
        "version":"2.0"
    }
Note You can use the SET property only after you upgrade GDB to 1.0.20 or later to support this feature. When you use the SET property, confirm the instance version.