Updated on 2025-09-18 GMT+08:00

Reversing a Lookup Table

Function

This API is used to reversing a lookup table.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/code-tables/database

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Project ID and Account ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

directory_id

No

String

Directory ID, which is a string

Request Parameters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

dw_type

Yes

String

Data connection type, which corresponds to the type of the data warehouse where the table is located. The value can be DWS, MRS_HIVE, POSTGRESQL, MRS_SPARK, CLICKHOUSE, MYSQL, ORACLE, or DORIS.

dw_id

Yes

String

ID of the data connection configured in Management Center

dw_name

Yes

String

Name of the data connection configured in Management Center

db_name

Yes

String

Database where the data table is located

queue_name

No

String

Queue required for executing SQL statements through the DLI data connection. This parameter is mandatory when the data connection type is DLI.

schema

No

String

Schema of the table when the data connection type is DWS or POSTGRESQL

reverse_type

No

String

Whether there are search criteria

page_number

No

Integer

Current page number of an entire DB reversing task

page_size

No

Integer

Number of records on each page in an entire DB reversing task

key_word

No

String

Keyword for reversely searching for a table. 1. A maximum of 2,000 characters are allowed. 2. Multi-condition search is an exact search. Search criteria are separated by semicolons (;). 3. A single condition (with no semicolon) is used for fuzzy search. 4. A maximum of 5,000 tables can be returned.

tb_names

No

Array of strings

Table name array

biz_catalog_id

No

String

Business category ID

update_exist

No

Boolean

Whether to update an existing table

catalog_path

No

String

Path of the subject to which the logical entity, physical table, dimension table, fact table, or summary table to be reversed belongs. The value is in {"l1Id":"","l2Id":"","l3Id":""} format.

data_involve

No

String

Reverse table data: not reverse; overwrite;

name_origin

No

String

Source of the table name, which can be the table comment or table name in English

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

data

data object

Data returned by the interface.

Table 5 data

Parameter

Type

Description

value

String

SQL information.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.6000, indicating that the request fails to be processed.

error_msg

String

Error message

data

Object

Returned data information.

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.6000, indicating that the request fails to be processed.

error_msg

String

Error message

data

Object

Returned data information.

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.6000, indicating that the request fails to be processed.

error_msg

String

Error message

data

Object

Returned data information.

Example Requests

Reverse a data table to a specified directory based on the request body parameters.

POST https://{endpoint}/v1/{project_id}/code-tables/database?directory_id=1046095008471683072

{
  "dw_type" : "DLI",
  "dw_id" : "8259af52bd294f98920ebce75a426391",
  "dw_name" : "dli",
  "db_name" : "bi",
  "queue_name" : "dlm",
  "schema" : null,
  "reverse_type" : "PART",
  "tb_names" : [ "aaa_new" ],
  "update_exist" : true,
  "name_origin" : "DESCRIPTION",
  "page_number" : null,
  "page_size" : null,
  "data_involve" : "OVERWRITE"
}

Example Responses

Status code: 200

The operation is successful, and the returned data is DDL.

{
  "data" : {
    "value" : {
      "id" : "1396947579547328513",
      "tenant_id" : "0833a5737480d53b2f25c010dc1a7b88-workspace-eeb055e69c624311b6b9cfee89a4ec70",
      "group_id" : "1396947579547328512",
      "biz_name" : null,
      "biz_id" : null,
      "operation_status" : "RUNNING",
      "operation_type" : "CODETABLE_REVERSE_DB",
      "biz_info" : null,
      "create_by" : "test_user",
      "remark" : null,
      "total" : 0,
      "success" : 0,
      "failed" : 0,
      "rate" : null,
      "logs" : null,
      "groups" : [ ]
    }
  }
}

Status code: 400

BadRequest

{
  "error_code" : "DS.60xx",
  "error_msg" : "The user request is illegal."
}

Status code: 401

Unauthorized

{
  "error_code" : "DS.60xx",
  "error_msg" : "User authentication failed."
}

Status code: 403

Forbidden

{
  "error_code" : "DS.60xx",
  "error_msg" : "The user does not have permission to call this API."
}

Status Codes

Status Code

Description

200

The operation is successful, and the returned data is DDL.

400

BadRequest

401

Unauthorized

403

Forbidden