Tables management

This topic discusses the life cycle of tables and associated management commands that are helpful for exploring, creating and altering tables.

Select the links in the table below for more information about them.

For information on optimizing table schema, see Schema optimization best practices.

Commands Operation
.alter table docstring, .alter table folder Manage table display properties
.create ingestion mapping, .show ingestion mappings, .alter ingestion mapping, .drop ingestion mapping Manage ingestion mapping
.create tables, .create table, .alter table, .alter-merge table, .drop tables, .drop table, .undo drop table, .rename table Create/modify/drop tables
.show tables .show table details.show table schema Enumerate tables in a database
.ingest, .set, .append, .set-or-append (see Data ingestion overview). Data ingestion into a table
.clear table data Clears all the data of a table

CRUD naming conventions for tables

(See full details in the sections linked to in the table, above.)

Command syntax Semantics
.create entityType entityName ... If an entity of that type and name exists, returns the entity. Otherwise, create the entity.
.create-merge entityType entityName... If an entity of that type and name exists, merge the existing entity with the specified entity. Otherwise, create the entity.
.alter entityType entityName ... If an entity of that type and name does not exist, error. Otherwise, replace it with the specified entity.
.alter-merge entityType entityName ... If an entity of that type and name does not exist, error. Otherwise, merge it with the specified entity.
.drop entityType entityName ... If an entity of that type and name does not exist, error. Otherwise, drop it.
.drop entityType entityName ifexists ... If an entity of that type and name does not exist, return. Otherwise, drop it.

Note

"Merge" is a logical merge of two entities:

  • If a property is defined for one entity but not the other, it appears with its original value in the merged entity.
  • If a property is defined for both entities and has the same value in both, it appears once with that value in the merged entity.
  • If a property is defined for both entities but has different values, an error is raised.