View browsable connectors¶
Lists the connectors in the current workspace that can browse databases, tables, or collections, and displays the query operations supported by each connector. After selecting an available connector, query the database, schema, object and field structure.
GET https://moi.matrixorigin.cn/newmoi/connectors/structured/v1/sources
Preparation before calling¶
Prepare a personal access token and target workspace ID that has access to the target workspace. The response only contains connectors that you have permission to use.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: The workspace ID to be queried, passed through theX-Workspace-IDHeader.
Supported sources and discovery paths¶
Structured discovery currently supports Hive, MySQL, SQL Server, Oracle, PostgreSQL, and MongoDB. The following table explains each type of object discovery path; when actually called, the ability marked as true in the response shall prevail.
connector type |
|
discovery path |
Object identifier |
|---|---|---|---|
Hive |
|
Database → Table → Table Structure |
|
MySQL |
|
Database → Table → Table Structure |
|
SQL Server |
|
Database → Schema → Table → Table structure |
|
Oracle |
|
Database → Schema → Table → Table structure |
|
PostgreSQL |
|
Database → Schema → Table → Table structure |
|
MongoDB |
|
Database → Collection → Table Structure |
|
Although MatrixOne can be created as a database connector, it is currently not returned through this interface, and its database, table or table structure cannot be queried using this set of interfaces.
Request example¶
curl "https://moi.matrixorigin.cn/newmoi/connectors/structured/v1/sources" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Successful response¶
Returns 200 on success.
{
"code": "OK",
"msg": "OK",
"data": {
"sources": [
{
"connector_id": "conn_01",
"connector_name": "orders_mysql",
"source_type": "SOURCE_TYPE_MYSQL",
"enabled": true,
"disabled_reason": "",
"capability_profile_hash": "capability-profile-hash",
"capabilities": {
"list_databases": true,
"list_schemas": false,
"list_tables": true,
"describe_schema": true,
"sample": false,
"backfill_start_resolve": false,
"hive_partitions": false,
"mongodb_flatten": false
}
}
]
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
object[] |
The connectors in the current workspace that are available or evaluable for structured discovery. |
|
string |
Connector ID. Subsequent discovery of the interface uses this ID. |
|
string |
Connector name. |
|
string |
Structured source type. |
|
boolean |
Whether the discovery interface corresponding to this entry can continue to be called. Only entries are available to proceed to subsequent steps. |
|
string |
The reason why it is not available. When the value is |
|
string |
A summary of the current capability description. This value may change when the capability configuration changes; when creating a structured import task, fill in this value into |
|
object |
The structured source capabilities that the current connector can call. Only make corresponding requests for capabilities marked as |
|
boolean |
Whether the database can be queried. |
|
boolean |
Whether the database Schema can be queried. |
|
boolean |
Whether the table or collection can be queried. |
|
boolean |
Whether the field structure of the table or collection can be queried. |
|
boolean |
Whether source data sampling is supported. |
|
boolean |
Whether to support parsing the backfill starting point of structured import. |
|
boolean |
Whether to support querying Hive partitions. |
|
boolean |
Whether to support MongoDB’s flat mapping capability. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
In field paths, [] means each item in an array. For example, data.sources[].connector_id is the connector_id field of each item in data.sources.
Error response¶
{
"code": "STRUCTURED_CONNECTOR_SERVICE_UNAVAILABLE",
"msg": "service unavailable",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The current service does not provide structured data source discovery. |
This group of interfaces is temporarily unavailable. |
|
|
The structured data source feature is not enabled in the current workspace. |
Check if this feature is available for this workspace. |
|
|
The service failed to list available connectors. |
Keep the desensitization error message and try again. |
Follow-up operations¶
With a saved connector selected, query the connector database with its ID. Continue only if the connector has a capability tag in the list that supports enumerating databases.