Metadata Primary Keys


Metadata Primary Keys


This operation returns information about a table’s primary keys.

Request

GET https://cloud.cdata.com/api/primaryKeys

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

Response

HTTP 200 OK

{
    "results": [
        {
            "schema": [
                {
                    "ordinal": 0,
                    "catalogName": "CData",
                    "schemaName": "QueryFederation",
                    "tableName": "sys_keycolumns",
                    "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_keycolumns",
                    "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_keycolumns",
                    "columnName": "TABLE_NAME",
                    "columnLabel": "TABLE_NAME",
                    "dataType": 5,
                    "dataTypeName": "VARCHAR",
                    "length": 512,
                    "precision": 512,
                    "scale": 0,
                    "nullable": true
                },
                
                (...)
                
            ],
            "rows": [
                [
                    "Salesforce1",
                    "Salesforce",
                    "Account",
                    "Id",
                    null,
                    1
                ]
            ],
            "affectedRows": -1
        }
    ]
}

Fields

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.
PK_NAME String The primary key name.
KEY_SEQ Integer The position of the column within the primary key (1-based).