Table Schema Action

Request

GET /api/<db>/<table>/_schema

Description

用于获取指定表的表结构信息。该接口目前用于 Spark/Flink Doris Connector 中, 获取 Doris 的表结构信息。

Path parameters

  • <db>

指定数据库 - <table>

指定表

Query parameters

无

Request body

无

Response

  • http接口返回如下:
1. {
2. "msg": "success",
3. "code": 0,
4. "data": {
5. "properties": [{
6. "type": "INT",
7. "name": "k1",
8. "comment": "",
9. "aggregation_type":""
10. }, {
11. "type": "INT",
12. "name": "k2",
13. "comment": "",
14. "aggregation_type":"MAX"
15. }],
16. "keysType":UNIQUE_KEYS,
17. "status": 200
18. },
19. "count": 0
20. }
  • http v2接口返回如下:
1. {
2. "msg": "success",
3. "code": 0,
4. "data": {
5. "properties": [{
6. "type": "INT",
7. "name": "k1",
8. "comment": ""
9. }, {
10. "type": "INT",
11. "name": "k2",
12. "comment": ""
13. }],
14. "keysType":UNIQUE_KEYS,
15. "status": 200
16. },
17. "count": 0
18. }

注意:区别为http方式比http v2方式多返回aggregation_type字段,http v2开启是通过enable_http_server_v2进行设置,具体参数说明详见fe参数设置

Examples

  1. 通过http获取指定表的表结构信息。

``` 1. GET /api/db1/tbl1/_schema

  1. Response:
  2. {
  3. "msg": "success",
  4. "code": 0,
  5. "data": {
  6. "properties": [{
  7. "type": "INT",
  8. "name": "k1",
  9. "comment": "",
  10. "aggregation_type":""
  11. }, {
  12. "type": "INT",
  13. "name": "k2",
  14. "comment": "",
  15. "aggregation_type":"MAX"
  16. }],
  17. "keysType":UNIQUE_KEYS,
  18. "status": 200
  19. },
  20. "count": 0
  21. } ```
  22. 通过http v2获取指定表的表结构信息。

``` 1. GET /api/db1/tbl1/_schema

  1. Response:
  2. {
  3. "msg": "success",
  4. "code": 0,
  5. "data": {
  6. "properties": [{
  7. "type": "INT",
  8. "name": "k1",
  9. "comment": ""
  10. }, {
  11. "type": "INT",
  12. "name": "k2",
  13. "comment": ""
  14. }],
  15. "keysType":UNIQUE_KEYS,
  16. "status": 200
  17. },
  18. "count": 0
  19. } ```