Metadata Primary Keys

Version 22.0.8486


Metadata Primary Keys

Version 22.0.8486


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

Request Format

GET /rest.rsc/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 Format

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

Example

Request

GET https://myconnectserver/rest.rsc/primaryKeys?tableName=Account

Response

{
    "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
        }
    ]
}