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.
POST https://moi.matrixorigin.cn/newmoi/meta/table/ddl
Preparation before calling¶
Prepare the personal access token, workspace ID, database name, and object name. You can first query the table in the database to confirm the table or view name.
The examples below use $AI_STUDIO_API_KEY, $WORKSPACE_ID, $DATABASE, and $TABLE.
Request body¶
Replace caller-specific values in the example with actual values.
db_namestringRequired- The name of the database where the table or view resides.
table_namestringRequired- The name of the table or view to read DDL from.
Request example
curl -X POST "https://moi.matrixorigin.cn/newmoi/meta/table/ddl" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{\"db_name\":\"$DATABASE\",\"table_name\":\"$TABLE\"}"
Successful response¶
{"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¶
codeinteger or string- Error code or status.
messagestring- Error message.
Error response example
{
"code": 404,
"message": "对象不存在"
}
Follow-up operations¶
View table column list when returning to the list.
Last updated on