Meta functions

These functions provide table information including column details and metadata. These functions are particularly useful for checking if tables contain a designated timestamp column.

table_columns#

table_columns('tableName') returns the schema of a table

Arguments:

  • tableName is the name of an existing table as a string

Return value:

Returns a table with the following columns:

  • column - name of the available columns in the table
  • type - type of the column
  • indexed - if indexing is applied to this column
  • indexBlockCapacity - how many row IDs to store in a single storage block on disk
  • symbolCached - whether this symbol column is cached
  • symbolCapacity - how many distinct values this column of symbol type is expected to have
  • designated - if this is set as the designated timestamp column for this table

For more details on the meaning and use of these values, see the CREATE TABLE documentation.

Examples:

Get all columns in a table
table_columns('my_table')
columntypeindexedindexBlockCapacitysymbolCachedsymbolCapacitydesignated
symbSYMBOLtrue1048576false256false
priceDOUBLEfalse0false0false
tsTIMESTAMPfalse0false0true
sSTRINGfalse0false0false
Get designated timestamp column
SELECT column, type, designated FROM table_columns('my_table') WHERE designated
columntypedesignated
tsTIMESTAMPtrue
Get the count of column types
SELECT type, count() FROM table_columns('my_table');
typecount
SYMBOL1
DOUBLE1
TIMESTAMP1
STRING1

tables#

tables() returns all tables in the database including table metadata.

Arguments:

  • tables() does not require arguments.

Return value:

Returns a table.

Examples:

List all tables
tables();
idnamedesignatedTimestamppartitionBymaxUncommittedRowso3MaxLag
1my_tabletsDAY500000300000000
2device_datanullNONE1000030000000
All tables in reverse alphabetical order
tables() ORDER BY name DESC;
idnamedesignatedTimestamppartitionBymaxUncommittedRowso3MaxLag
2device_datanullNONE1000030000000
1my_tabletsDAY500000300000000
All tables with a daily partitioning strategy
tables() WHERE partitionBy = 'DAY'
idnamedesignatedTimestamppartitionBymaxUncommittedRows
1my_tabletsDAY500000