Meta Action

Meta Info Action is used to obtain metadata information in the cluster. Such as database list, table structure, etc.

List Database

Request

  1. GET /api/meta/namespaces/<ns_name>/databases

Description

Get a list of all database names, arranged in alphabetical order.

Path parameters

None

Query parameters

  • limit

    Limit the number of result rows returned

  • offset

    Pagination information, need to be used with limit

Request body

None

Response

  1. {
  2. "msg": "OK",
  3. "code": 0,
  4. "data": [
  5. "db1", "db2", "db3", ...
  6. ],
  7. "count": 3
  8. }
  • The data field returns a list of database names.

List Table

Request

  1. GET /api/meta/namespaces/<ns_name>/databases/<db_name>/tables

Description

Get a list of tables in the specified database, arranged in alphabetical order.

Path parameters

  • <db_name>

    Specify database

Query parameters

  • limit

    Limit the number of result rows returned

  • offset

    Pagination information, need to be used with limit

Request body

None

Response

  1. {
  2. "msg": "OK",
  3. "code": 0,
  4. "data": [
  5. "tbl1", "tbl2", "tbl3", ...
  6. ],
  7. "count": 0
  8. }
  • The data field returns a list of table names.

Schema Info

Request

  1. GET /api/meta/namespaces/<ns_name>/databases/<db_name>/tables/<tbl_name>/schema

Description

Get the table structure information of the specified table in the specified database.

Path parameters

  • <db_name>

    Specify the database name

  • <tbl_name>

    Specify table name

Query parameters

  • with_mv

    Optional. If not specified, the table structure of the base table is returned by default. If specified, all rollup index will also be returned.

Request body

None

Response

  1. GET /api/meta/namespaces/default/databases/db1/tables/tbl1/schema
  2. {
  3. "msg": "success",
  4. "code": 0,
  5. "data": {
  6. "tbl1": {
  7. "schema": [{
  8. "Field": "k1",
  9. "Type": "INT",
  10. "Null": "Yes",
  11. "Extra": "",
  12. "Default": null,
  13. "Key": "true"
  14. },
  15. {
  16. "Field": "k2",
  17. "Type": "INT",
  18. "Null": "Yes",
  19. "Extra": "",
  20. "Default": null,
  21. "Key": "true"
  22. }
  23. ],
  24. "is_base": true
  25. }
  26. },
  27. "count": 0
  28. }
  1. GET /api/meta/namespaces/default/databases/db1/tables/tbl1/schema?with_mv?=1
  2. {
  3. "msg": "success",
  4. "code": 0,
  5. "data": {
  6. "tbl1": {
  7. "schema": [{
  8. "Field": "k1",
  9. "Type": "INT",
  10. "Null": "Yes",
  11. "Extra": "",
  12. "Default": null,
  13. "Key": "true"
  14. },
  15. {
  16. "Field": "k2",
  17. "Type": "INT",
  18. "Null": "Yes",
  19. "Extra": "",
  20. "Default": null,
  21. "Key": "true"
  22. }
  23. ],
  24. "is_base": true
  25. },
  26. "rollup1": {
  27. "schema": [{
  28. "Field": "k1",
  29. "Type": "INT",
  30. "Null": "Yes",
  31. "Extra": "",
  32. "Default": null,
  33. "Key": "true"
  34. }],
  35. "is_base": false
  36. }
  37. },
  38. "count": 0
  39. }
  • The data field returns the table structure information of the base table or rollup table.