Metadata Imported Keys

Version 22.0.8486


Metadata Imported Keys

Version 22.0.8486


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

Request Format

GET /rest.rsc/importedKeys

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
PKTABLE_CATALOG String The primary key catalog name.
PKTABLE_SCHEMA String The primary key schema name.
PKTABLE_NAME String The primary key table name.
PKCOLUMN_NAME String The primary key column name.
PK_NAME String The primary key name.
FKTABLE_CATALOG String The foreign key catalog name.
FKTABLE_SCHEMA String The foreign key schema name.
FKTABLE_NAME String The foreign key table name.
FKCOLUMN_NAME String The foreign key column name.
FK_NAME String The foreign key name.
KEY_SEQ Integer The position of the foreign key column within the foreign key (1-based).

Example

Request

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

Response

{
    "results": [
        {
            "schema": [
                {
                    "ordinal": 0,
                    "catalogName": "CData",
                    "schemaName": "QueryFederation",
                    "tableName": "sys_foreignkeys",
                    "columnName": "PKTABLE_CATALOG",
                    "columnLabel": "PKTABLE_CATALOG",
                    "dataType": 5,
                    "dataTypeName": "VARCHAR",
                    "length": 512,
                    "precision": 512,
                    "scale": 0,
                    "nullable": true
                },
                {
                    "ordinal": 1,
                    "catalogName": "CData",
                    "schemaName": "QueryFederation",
                    "tableName": "sys_foreignkeys",
                    "columnName": "PKTABLE_SCHEMA",
                    "columnLabel": "PKTABLE_SCHEMA",
                    "dataType": 5,
                    "dataTypeName": "VARCHAR",
                    "length": 512,
                    "precision": 512,
                    "scale": 0,
                    "nullable": true
                },
                {
                    "ordinal": 2,
                    "catalogName": "CData",
                    "schemaName": "QueryFederation",
                    "tableName": "sys_foreignkeys",
                    "columnName": "PKTABLE_NAME",
                    "columnLabel": "PKTABLE_NAME",
                    "dataType": 5,
                    "dataTypeName": "VARCHAR",
                    "length": 512,
                    "precision": 512,
                    "scale": 0,
                    "nullable": true
                },
                
                (...)

            ],
            "rows": [
                [
                    "Salesforce1",
                    "Salesforce",
                    "Account",
                    "Id",
                    "PK_Account_Id",
                    "Salesforce1",
                    "Salesforce",
                    "Account",
                    "MasterRecordId",
                    "FK_Account_MasterRecordId_REF_Account_Id",
                    1
                ],
                [
                    "Salesforce1",
                    "Salesforce",
                    "RecordType",
                    "Id",
                    "PK_RecordType_Id",
                    "Salesforce1",
                    "Salesforce",
                    "Account",
                    "RecordTypeId",
                    "FK_Account_RecordTypeId_REF_RecordType_Id",
                    1
                ],
                [
                    "Salesforce1",
                    "Salesforce",
                    "Account",
                    "Id",
                    "PK_Account_Id",
                    "Salesforce1",
                    "Salesforce",
                    "Account",
                    "ParentId",
                    "FK_Account_ParentId_REF_Account_Id",
                    1
                ],
                
                (...)

            ],
            "affectedRows": -1
        }
    ]
}