schema#

swordfish.function.schema()#

Display information about the schema of a table or a database.

Parameters:

table (Union[Alias[Literal["dbHandle"]], Constant]) – Can be a table object or a database handle.

Returns:

An unordered dictionary containing the following information (in alphabetical order):

  • atomic: the level at which the atomicity is guaranteed for a write transaction. It can be TRANS or CHUNK.

  • chunkGranularity: the chunk granularity which determines whether to allow concurrent writes to different tables in the same chunk. It can be TABLE or DATABASE.

  • clusterReplicationEnabled: whether asynchronous replication has been enabled.

  • colDefs: information about each column in the table:

    • name: column name

    • typeString: column type

    • typeInt: the type ID

    • extra: the scale of a DECIMAL value

    • comment: comment on the column

    • sensitive: whether this column is set as a sensitive column. It is returned only when table is a DFS table.

  • compressMethods: the compression methods used for specified columns of a DFS table.

    • name: Column names

    • compressMethods: Compression algorithm applied, including “lz4”, “delta”, or “zstd”.

  • databaseDir: the directory where the database is stored.

  • databaseOwner: the database creator.

  • dbUrl: path to the distributed database where the DFS table is located. It is returned only when table is a DFS table.

  • encryptMode: The table encryption mode specified during table creation. It is returned only when table is a DFS table.

  • engineType: the storage engine type. It can be OLAP or TSDB.

  • keepDuplicates: how to deal with records with duplicate sort key values.

  • keyColumn: key column(s) of the table. It is returned only when table contains key column(s).

  • partitionColumnIndex: the index that indicates the positions of partitioning columns. It returns -1 for a dimension table.

  • partitionColumnName: the partitioning column names.

  • partitionColumnType: the data type ID (which can be checked at Data Types and Data Forms) of the partitioning column.

  • partitionSchema: how the partitions are organized

  • partitionSites (optional): If the parameter locations is specified for function database, it displays the ip:port information of the specified node.

  • partitionTypeName / partitionType: the partitioning scheme and the corresponding ID, including VALUE(1), RANGE(2), LIST(3), COMPO(4), HASH(5).

  • sortColumns: the sort columns for a table.

  • softDelete: whether soft deletion of the table has been enabled. This field will only be returned for tables in TSDB databases. Return true if soft deletion has been enabled, false otherwise.

  • sortKeyMappingFunction: the mapping functions applied to sort keys.

  • tableComment: the comment for DFS tables.

  • tableName: table name. It is returned only when table is a DFS table.

  • tableOwner: the table creator.

  • partitionFunction: the function applied to a column for data partitioning. It is a STRING vector with each element as a function signature. If an element is “asis”, meaning no function is applied to that column. For example, partitionFunction->[“myPartitionFunc{, 6, 8}”,”asis”].

  • latestKeyCache: whether the latest value cache is enabled.

  • compressHashSortKey: whether the compression for sort columns is enabled.

Return type:

Constant