Metadata Exported Keys

Version 22.0.8486


Metadata Exported Keys

Version 22.0.8486


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

Request Format

GET /rest.rsc/exportedKeys

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/exportedKeys?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",
                    "Contact",
                    "Id",
                    "PK_Contact_Id",
                    "Salesforce1",
                    "Salesforce",
                    "AccountContactRelation",
                    "ContactId",
                    "FK_AccountContactRelation_ContactId_REF_Contact_Id",
                    1
                ],
                [
                    "Salesforce1",
                    "Salesforce",
                    "Contact",
                    "Id",
                    "PK_Contact_Id",
                    "Salesforce1",
                    "Salesforce",
                    "AccountContactRole",
                    "ContactId",
                    "FK_AccountContactRole_ContactId_REF_Contact_Id",
                    1
                ],
                [
                    "Salesforce1",
                    "Salesforce",
                    "Contact",
                    "Id",
                    "PK_Contact_Id",
                    "Salesforce1",
                    "Salesforce",
                    "Asset",
                    "ContactId",
                    "FK_Asset_ContactId_REF_Contact_Id",
                    1
                ],
                
                (...)

            ],
            "affectedRows": -1
        }
    ]
}