Export GraphCompute data to a MaxCompute table

Updated at:

This topic describes how to export data from GraphCompute to a table in a MaxCompute project. You can export data from a node or edge table. Exporting data from an entire graph is not currently supported.

Procedure

Step 1: Enable table export in GraphCompute

For each vertex or edge you want to export:

1. On the data configuration page, disable index optimization.

2. Save the table configuration and Publish the graph.

3. Select the vertex or edge and trigger index building again. Wait for the backflow to complete. You can export the index generated after the backflow to MaxCompute.

Reference images:

On the data configuration page, find the index optimization toggle for the target vertex or edge table and turn it off.

The Save and Publish buttons are in the upper-right corner of the page. A red exclamation mark appears in the corner of the Publish button.

Right-click the vertex or edge and select Trigger index building from the shortcut menu.

In the Backflow Log panel, confirm that the status of the corresponding vertex or edge (for example, skc_feature) shows Backflow complete (100%).

Step 2: Select a target MaxCompute table

Scenario 1: The target is an existing MaxCompute table.

1. Grant write permissions on the table to the GraphCompute account.

  add user ALIYUN$openias; 
  grant Describe,Alter,Update,Select on table <table_name> to USER ALIYUN$openias;

2. For details on granting permissions, see reference.

Scenario 2: You need to create a new MaxCompute table.

1. Create a MaxCompute table.

In the Graph O&M pane, right-click a node, select Data Export, and then click Get Create Table SQL to obtain the CREATE TABLE statement for the table.

On the data export configuration page, set Export Type to MaxCompute. Enter the Specified Project (for example, openrec_new) and Specified Table (for example, test_momet). Select the Exportable Version, and enter the New Partition Version (for example, ds=2023032302).

In the View Create Table SQL Statement dialog box, you can view the complete CREATE TABLE statement for the target table, including all field definitions and PARTITIONED BY information. Click the copy icon to copy the SQL and run it in MaxCompute to create the table.

2. Grant write permissions on the table to the GraphCompute account.

  add user ALIYUN$openias; 
  grant Describe,Alter,Update,Select on table <table_name> to USER ALIYUN$openias;

3. For details on granting permissions, see reference.

Step 3: Configure a one-time export task

In the Graph O&M pane, right-click a vertex or edge and select Data Export. On the data export configuration page, configure fields such as Export Type and Specified Partition, and then click Export. You must export the data to an existing partition in the MaxCompute table.

1. After creating the table, use the ALTER TABLE command to add the partition:

alter table <maxcompute_project_name>.<table_name> add partition (ds='2023032302')  

If the partition already contains data, the exported data is appended to the table.

2. Verify the export prerequisites. For example, check that the MaxCompute table and partition have been created and that the account has the required permissions.

3. Enter the name of an existing partition and click Export.

4. Wait for the export task to complete. You can view information about the task in the task history.

Step 4: Configure a scheduled export task

In the Graph O&M pane, right-click a vertex or edge and select Scheduled Export. The task automatically creates a new partition in the MaxCompute table based on the specified partition rule.

1. Verify the export prerequisites. For example, check that the MaxCompute table has been created and that the account has the required permissions.

2. Enter the rule for the new partition and click Export. For example, you can set the rule to yyyyMMdd for daily exports or yyyyMMddHH for hourly exports.

3. Wait for the export task to complete. You can view information about the task in the task history.

The scheduled export configuration dialog box contains settings such as Export Type, Specified Project, Specified Table, a partition rule input field, and the Export button.