Skip to main content

List UniqKeys

Interface Overview

Gets a list of unique keys for database tables so that the unique key is set as the primary key when creating a task

Interface Address

/cloudcanal/console/api/v1/openapi/datasource/listuniqs

Request Manner

POST

Request Parameters

ParameterNameParameter DescriptionRequestTypeWhether RequiredDataType
clusterIdCluster ID of the machine set that attempts to connect to the data sourceBodyTrueLong
dataSourceIdID of the target data sourceBodyTrueLong
hostTypeSelected data source network type

PRIVATE (intranet)
PUBLIC (internet)
BodyTrueString
dbNameDatabase name; for MySQL, please fill in the "schemas" parameterBodyFalseString
schemasList of schema names, including MySQL dbname, PostgreSQL schema, and Oracle schemaBodyTrueList

Public response result

ParameterNameParameter DescriptionType(Java)NotNull
code1: success, 0: failureStringTrue
dataObjectFalse
msgStringFalse
requestIdStringTrue

Data Parameter

data contains multiple sets of json objects, each set of keys representing the table, and value representing the unique key queue owned by the table.

key Parameter Description:

ParameterNameParameter DescriptionType(Java)NotNull
dbNameDatabase name, may be empty depending on the data sourceStringFalse
tableSchemaSchema, may be empty depending on the data sourceStringFalse
tableNameTable nameStringTrue

value array element

ParameterNameParameter DescriptionType(Java)NotNull
constraintCatalogName of the database to which the constraint belongs; default is empty for MySQLStringFalse
constraintSchemaSchema to which the constraint belongsStringTrue
constraintNameName of the constraintStringTrue
tableSchemaSchema on which the constraint actsStringTrue
tableNameTable on which the constraint acts (not the table on which foreign key dependency exists)StringTrue
constraintTypeType of constraint

PrimaryKey
Unique
ForeignKey
StringTrue
colsColumns included in the constraintStringTrue

Response Example

{
"requestId": "c7ed1d38-2bd0-11ec-b616-e92730e52825",
"code": "1",
"msg": "request success",
"data": {
"{\"dbName\":\"console\",\"tableSchema\":null,\"tableName\":\"meta_snapshot\"}": [
{
"constraintCatalog": null,
"constraintSchema": "console",
"constraintName": "binlog_file_offest",
"tableSchema": "console",
"tableName": "meta_snapshot",
"constraintType": "Unique",
"cols": [
"destination",
"binlog_master_id",
"binlog_file",
"binlog_offset"
]
}
],
"{\"dbName\":\"console\",\"tableSchema\":null,\"tableName\":\"console_user\"}": [
{
"constraintCatalog": null,
"constraintSchema": "console",
"constraintName": "idx_unique_ak",
"tableSchema": "console",
"tableName": "console_user",
"constraintType": "Unique",
"cols": [
"ak"
]
},
{
"constraintCatalog": null,
"constraintSchema": "console",
"constraintName": "idx_unique_sk",
"tableSchema": "console",
"tableName": "console_user",
"constraintType": "Unique",
"cols": [
"sk"
]
}
]
}
}