This topic describes the parameters that Maxgraph Writer supports and how to configure it by using the code editor.
Note If you want Maxgraph Writer to write data from MaxCompute tables to Maxgraph, grant
the Maxgraph build account the read permissions on the MaxCompute tables in the source
MaxCompute project. Contact the Maxgraph administrator to obtain the Maxgraph build
account.
To write data from MaxCompute tables to Maxgraph, you can perform the following steps
to create data records and upload the data records:
- Create a MapReduce job to map columns in a MaxCompute table to the vertices or edges in Maxgraph. The MapReduce job converts the data records to the format that Maxgraph supports.
- Upload the data records that are converted by the MapReduce job to the storage of Maxgraph.
Parameters
Parameter | Description | Required | Default value |
---|---|---|---|
endpoint | The endpoint of Maxgraph. | Yes | N/A |
graphName | The name of the Maxgraph instance. | Yes | N/A |
accessId | The AccessKey ID of the account that you can use to connect to Maxgraph. | Yes | N/A |
accessKey | The AccessKey secret of the account that you can use to connect to Maxgraph. | Yes | N/A |
label | The label, which is the name of the vertex or edge. | Yes | N/A |
labelType | The type of the label. Valid values: vertex and edge. | Yes | N/A |
srcLabel | The label of the start vertex in an edge. This parameter takes effect only when you import data about edges. | Yes | N/A |
dstLabel | The label of the end vertex in an edge. This parameter takes effect only when you import data about edges. | Yes | N/A |
splitSize | The size of a shard in the MapReduce job. | No | 256MB |
onlineMode | The mode in which data is uploaded to the storage of Maxgraph. Valid values:
|
No | type |
platform | The name of the destination data store. Default value: odps. | No | odps |
column | The name of the vertex property. This parameter takes effect only when you import data about vertices. | Yes | N/A |
name | The name of the property. | Required only when you import data about edges | N/A |
propertyType | The type of the property. Valid values: srcPrimaryKey, dstPrimaryKey, and edgeProperty. | Required only when you import data about edges | N/A |
srcPrimaryKey | The primary key of the start vertex. This parameter takes effect only when you import data about edges. | Required only when you import data about edges | N/A |
dstPrimaryKey | The primary key of the end vertex. This parameter takes effect only when you import data about edges. | Required only when you import data about edges | N/A |
edgeProperty | The properties of the edge. This parameter can be left empty if the edge has no properties. | No | N/A |
Configure Maxgraph Writer by using the code editor
You can configure Maxgraph Writer by using the code editor. For more information, see Create a sync node by using the code editor.
The following examples show how to configure sync nodes to write data about vertices
and edges to Maxgraph.
- Configure a sync node to write data about vertices to Maxgraph
{ "job": { "setting": { "speed": { "channel": 1 // Set the value to 1. }, "errorLimit": { "record": 1000 } }, "content": [ { "reader": { "name": "odpsreader", "parameter": { "accessId": "*****", "accessKey": "*****", "project": "maxgraph_dev", "table": "maxgraph_demo_person", "column": [ // The names of columns in the table in MaxCompute. The value of this parameter has a one-to-one mapping with the value of the column parameter of Maxgraph Writer. "id", "name", "age" ], "packageAuthorizedProject": "biggraph_dev", "splitMode": "record", "odpsServer": "******" } }, "writer": { "name": "maxgraphwriter", "parameter": { "endpoint": "http://graph.alibaba.net", "graphName": "xxx", "accessId": "xxx", "accessKey": "xxx", "label": "person", "labelType": "vertex", "onlineMode": "partition", "platform": "odps", "splitSize": "256", "column": [ // The names of vertex properties in Maxgraph. The value of this parameter has a one-to-one mapping with the value of the column parameter of MaxCompute Reader. "id", "name", "age" ] } } } ] } }
- Configure a sync node to write data about edges to Maxgraph
{ "job": { "setting": { "speed": { "channel": 1 // Set the value to 1. }, "errorLimit": { "record": 1000 } }, "content": [ { "reader": { "name": "odpsreader", "parameter": { "accessId": "*****", "accessKey": "*****", "project": "maxgraph_dev", "table": "maxgraph_demo_knows", "column": [ "person_id", "person_id2", "weight", "id" ], "packageAuthorizedProject": "biggraph_dev", "splitMode": "record", "odpsServer": "****" } }, "writer": { "name": "maxgraphwriter", "parameter": { "endpoint": "http://graph.alibaba.net", "graphName": "xxx", "accessId": "xxx", "accessKey": "xxx", "label": "knows", "labelType": "edge", "srcLabel": "person", "dstLabel": "person", "onlineMode": "partition", "platform": "odps", "splitSize": "256", "column": [ { "name": "id", // The name of the edge property in Maxgraph. "propertyType": "srcPrimaryKey" // The type of the edge property in Maxgraph. This parameter specifies whether a data record is the start vertex, end vertex, or a property of an edge. }, { "name": "id", "propertyType": "dstPrimaryKey" }, { "name": "weight", "propertyType": "edgeProperty" }, { "name": "id", "propertyType": "edgeProperty" } ] } } } ] } }