Get DDL Statement Action

Request

GET /api/_get_ddl

Description

Used to get the table creation statement, partition creation statement and rollup statement of the specified table.

Path parameters

None

Query parameters

  • db

    Specify database

  • table

    Specify table

Request body

None

Response

  1. {
  2. "msg": "OK",
  3. "code": 0,
  4. "data": {
  5. "create_partition": ["ALTER TABLE `tbl1` ADD PARTITION ..."],
  6. "create_table": ["CREATE TABLE `tbl1` ...],
  7. "create_rollup": ["ALTER TABLE `tbl1` ADD ROLLUP ..."]
  8. },
  9. "count": 0
  10. }

Examples

  1. Get the DDL statement of the specified table

    1. GET GET /api/_get_ddl?db=db1&table=tbl1
    2. Response
    3. {
    4. "msg": "OK",
    5. "code": 0,
    6. "data": {
    7. "create_partition": [],
    8. "create_table": ["CREATE TABLE `tbl1` (\n `k1` int(11) NULL COMMENT \"\",\n `k2` int(11) NULL COMMENT \"\"\n) ENGINE=OLAP\nDUPLICATE KEY(`k1`, `k2`)\nCOMMENT \"OLAP\"\nDISTRIBUTED BY HASH(`k1`) BUCKETS 1\nPROPERTIES (\n\"replication_num\" = \"1\",\n\"version_info\" = \"1,0\",\n\"in_memory\" = \"false\",\n\"storage_format\" = \"DEFAULT\"\n);"],
    9. "create_rollup": []
    10. },
    11. "count": 0
    12. }