View table or view creation statement¶
View the create statement for the table or view. The response contains the object definition and does not contain the data from the table.
HTTP
POST $CLOUDSIGMA_API_BASE/meta/table/ddl
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
You can first query the table in the database to confirm the table or view name.
Request¶
Replace caller-specific values in the example with actual values.
Shell
curl -X POST "$CLOUDSIGMA_API_BASE/meta/table/ddl" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{\"db_name\":\"$DATABASE\",\"table_name\":\"$TABLE\"}"
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
db_name | string | Required | The name of the database where the table or view resides. |
table_name | string | Required | The name of the table or view to read DDL from. |
Successful response¶
JSON
{"code":200,"data":{"create_sql":"CREATE TABLE orders (id INT PRIMARY KEY)"}}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
The |
Error response¶
JSON
{
"code": 404,
"message": "对象不存在"
}
| Field | Type | Description |
|---|---|---|
code | integer or string | Error code or status. |
message | string | Error message. |
Follow-up operations¶
View table column list when returning to the list.
Last updated on