Metadata Columns


Metadata Columns


This operation returns information about available table columns.

Request Format

GET /columns

Query String Parameters

Parameter Description Notes
catalogName Restricts results to the specified catalog. Optional
schemaName Restricts results to the specified schema. Optional
tableName Restricts results to the specified table. Optional
columnName Restricts results to the specified column. Optional

Response Format

This operation returns the following columns in our standard JSON result object.

Column Data Type Description
TABLE_CATALOG String The catalog name.
TABLE_SCHEMA String The schema name.
TABLE_NAME String The table name.
COLUMN_NAME String The column name.
DATA_TYPE Integer The column’s data type.
TYPE_NAME String The name of the column’s data type. May be data-source-specific.
COLUMN_SIZE Integer The column’s storage size.
PRECISION Integer; Nullable The column’s precision.
SCALE Integer; Nullable The column’s scale.
REMARKS String; Nullable A description of the column.
ORDINAL_POSITION Integer The column’s ordinal position (1-based).
IS_KEY Boolean Whether the column is part of a primary key.
IS_NULLABLE Boolean; Nullable Whether the column is nullable.
IS_AUTOINCREMENT Boolean; Nullable Whether the column is auto-increment.
IS_GENERATEDCOLUMN Boolean; Nullable Whether this is a generated column.

Example

Request

GET https://cloud.cdata.com/api/columns?tableName=Contact&columnName=Id

Response

{
    "results": [
        {
            "schema": [
                {
                    "ordinal": 0,
                    "catalogName": "CData",
                    "schemaName": "QueryFederation",
                    "tableName": "sys_tablecolumns",
                    "columnName": "TABLE_CATALOG",
                    "columnLabel": "TABLE_CATALOG",
                    "dataType": 5,
                    "dataTypeName": "VARCHAR",
                    "length": 255,
                    "precision": 255,
                    "scale": 0,
                    "nullable": true
                },
                {
                    "ordinal": 1,
                    "catalogName": "CData",
                    "schemaName": "QueryFederation",
                    "tableName": "sys_tablecolumns",
                    "columnName": "TABLE_SCHEMA",
                    "columnLabel": "TABLE_SCHEMA",
                    "dataType": 5,
                    "dataTypeName": "VARCHAR",
                    "length": 255,
                    "precision": 255,
                    "scale": 0,
                    "nullable": true
                },
                {
                    "ordinal": 2,
                    "catalogName": "CData",
                    "schemaName": "QueryFederation",
                    "tableName": "sys_tablecolumns",
                    "columnName": "TABLE_NAME",
                    "columnLabel": "TABLE_NAME",
                    "dataType": 5,
                    "dataTypeName": "VARCHAR",
                    "length": 512,
                    "precision": 512,
                    "scale": 0,
                    "nullable": true
                },

                (...)

            ],
            "rows": [
                [
                    "Salesforce1",
                    "Salesforce",
                    "Contact",
                    "Id",
                    5,
                    "varchar",
                    18,
                    0,
                    0,
                    "Label Contact ID corresponds to this field.",
                    1,
                    true,
                    false,
                    false,
                    true
                ]
            ],
            "affectedRows": -1
        }
    ]
}