Tables management

The eKuiper table command line tools allows you to manage the tables, such as create, describe, show and drop table definitions.

create a table

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

  1. create table $table_name $table_def | create table -f $table_def_file
  • Specify the table definition in command line.

Sample:

  1. # bin/kuiper create table my_table '(id bigint, name string, score float) WITH ( datasource = "lookup.json", FORMAT = "json", KEY = "id");'
  2. table my_table created

The command create a table named my_table.

  • Specify the table definition in file. If the table is complex, or the table is already wrote in text files with well organized formats, you can just specify the table definition through -f option.

Sample:

  1. # bin/kuiper create table -f /tmp/my_table.txt
  2. table my_table created

Below is the contents of my_table.txt.

  1. my_table(id bigint, name string, score float)
  2. WITH ( datasource = "lookup.json", FORMAT = "json", KEY = "id");

show tables

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

  1. show tables

Sample:

  1. # bin/kuiper show tables
  2. my_table

describe a table

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

  1. describe table $table_name

Sample:

  1. # bin/kuiper describe table my_table
  2. Fields
  3. --------------------------------------------------------------------------------
  4. id bigint
  5. name string
  6. score float
  7. FORMAT: json
  8. KEY: id
  9. DATASOURCE: lookup.json

drop a table

The command is used for drop the table definition.

  1. drop table $table_name

Sample:

  1. # bin/kuiper drop table my_table
  2. table my_table dropped