title | sidebar_label | description |
---|---|---|
Meta functions | Meta | Table and database metadata function reference documentation. |
These functions provide table information including column details and metadata such as commit lag parameters. 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 tabletype
- type of the columnindexed
- if indexing is applied to this columnindexBlockCapacity
- how many row IDs to store in a single storage block on disksymbolCached
- whether or not thissymbol
column is cachedsymbolCapacity
- how many distinct values this column ofsymbol
type is expected to havedesignated
- 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:
table_columns('my_table')
column | type | indexed | indexBlockCapacity | symbolCached | symbolCapacity | designated |
---|---|---|---|---|---|---|
symb | SYMBOL | true | 1048576 | false | 256 | false |
price | DOUBLE | false | 0 | false | 0 | false |
ts | TIMESTAMP | false | 0 | false | 0 | true |
s | STRING | false | 0 | false | 0 | false |
SELECT column, type, designated FROM table_columns('my_table') WHERE designated
column | type | designated |
---|---|---|
ts | TIMESTAMP | true |
SELECT type, count() FROM table_columns('my_table');
type | count |
---|---|
SYMBOL | 1 |
DOUBLE | 1 |
TIMESTAMP | 1 |
STRING | 1 |
tables
tables()
returns all tables in the database including table metadata.
Arguments:
tables()
does not require arguments.
Return value:
Returns a table
.
Examples:
tables();
id | name | designatedTimestamp | partitionBy | maxUncommittedRows | commitLag |
---|---|---|---|---|---|
1 | my_table | ts | DAY | 500000 | 300000000 |
2 | device_data | null | NONE | 10000 | 30000000 |
tables() ORDER BY name DESC;
id | name | designatedTimestamp | partitionBy | maxUncommittedRows | commitLag |
---|---|---|---|---|---|
2 | device_data | null | NONE | 10000 | 30000000 |
1 | my_table | ts | DAY | 500000 | 300000000 |
tables() WHERE partitionBy = 'DAY'
id | name | designatedTimestamp | partitionBy | maxUncommittedRows | commitLag |
---|---|---|---|---|---|
1 | my_table | ts | DAY | 500000 | 300000000 |