Tables management

The eKuiper REST api for tables allows you to manage the tables, such as create, describe, show and drop table definitions.

create a table

The API is used for creating a table. For more detailed information of table definition, please refer to tables.

  1. POST http://localhost:9081/tables

Request sample, the request is a json string with sql field.

  1. {"sql":"create table my_table (id bigint, name string, score float) WITH ( datasource = \"lookup.json\", FORMAT = \"json\", KEY = \"id\")"}

This API can run any table sql statements, not only table creation.

show tables

The API is used for displaying all of tables defined in the server.

  1. GET http://localhost:9081/tables

Response Sample:

  1. ["mytable"]

describe a table

The API is used for print the detailed definition of table.

  1. GET http://localhost:9081/tables/{id}}

Response Sample:

  1. {
  2. "Name": "demo",
  3. "StreamFields": [
  4. {
  5. "Name": "temperature",
  6. "FieldType": {
  7. "Type": 2
  8. }
  9. },
  10. {
  11. "Name": "ts",
  12. "FieldType": {
  13. "Type": 1
  14. }
  15. }
  16. ],
  17. "Options": {
  18. "DATASOURCE": "lookup.json",
  19. "FORMAT": "JSON"
  20. }
  21. }

update a table

The API is used for update the table definition.

  1. PUT http://localhost:9081/tables/{id}

Path parameter id is the id or name of the old table.

Request sample, the request is a json string with sql field.

  1. {"sql":"create table my_table (id bigint, name string, score float) WITH ( datasource = \"topic/temperature\", FORMAT = \"json\", KEY = \"id\")"}

drop a table

The API is used for drop the table definition.

  1. DELETE http://localhost:9081/tables/{id}