Table Schema Action
Request
GET /api/<db>/<table>/_schema
Description
Used to obtain the table structure information of the specified table. This interface is currently used in Spark/Flink Doris Connector. obtains Doris table structure information.
Path parameters
<db>
Specify database
- <table>
Specify table
Query parameters
None
Request body
None
Response
- The http interface returns as follows:
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. }
- The http v2 interface returns as follows:
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. }
Note: The difference is that the http method returns more aggregation_type fields than the http v2 method. The http v2 is enabled by setting enable_http_server_v2. For detailed parameter descriptions, see fe parameter settings
Examples
- Get the table structure information of the specified table via http interface.
``` 1. GET /api/db1/tbl1/_schema
- Response:
- {
- "msg": "success",
- "code": 0,
- "data": {
- "properties": [{
- "type": "INT",
- "name": "k1",
- "comment": "",
- "aggregation_type":""
- }, {
- "type": "INT",
- "name": "k2",
- "comment": "",
- "aggregation_type":"MAX"
- }],
- "keysType":UNIQUE_KEYS,
- "status": 200
- },
- "count": 0
- } ```
- Get the table structure information of the specified table via http v2 interface.
``` 1. GET /api/db1/tbl1/_schema
- Response:
- {
- "msg": "success",
- "code": 0,
- "data": {
- "properties": [{
- "type": "INT",
- "name": "k1",
- "comment": ""
- }, {
- "type": "INT",
- "name": "k2",
- "comment": ""
- }],
- "keysType":UNIQUE_KEYS,
- "status": 200
- },
- "count": 0
- } ```
