Data sources
Browse the database an installed data source reads, and check data source manifests, through two read-only operations
Two read-only operations work with your organization's data sources.
data.sources.browse lists what is in the database an installed query data
source reads: its schemas, a schema's tables, or a table's columns. It returns
names and types, never a row. data.sources.connectorProfiles checks data
source manifests: it compiles the manifests you send and lists what is wrong
with each one that does not compile.
import { createHttpPlatformTransport, createScrydonSDK } from '@scrydon/sdk/platform'
const platform = createScrydonSDK(
createHttpPlatformTransport({
baseUrl: 'https://scrydon.com',
headers: () => ({ authorization: `Bearer ${accessToken}` }),
})
)
const schemas = await platform.data.sources.browse({
sourceId: 'orders-db',
connectionRef: connectionId,
browse: { level: 'schemas' },
})
const { profiles, refusals } = await platform.data.sources.connectorProfiles({
sources: [{ sourceId: 'draft', manifestSnapshot: manifest }],
})| Operation | HTTP | What it does |
|---|---|---|
data.sources.browse | POST /api/platform/v1/data/sources/browse | Lists one level of the database an installed query data source reads. |
data.sources.connectorProfiles | POST /api/platform/v1/data/sources/connector-profiles | Compiles data source manifests into connector profiles, and lists every manifest that does not compile. |
Over HTTP, both need the tables:read scope. They are read-only and safe to
retry.
In a workflow, select the Scrydon tools Browse data source database and
Check data source manifests in an Agent block's tools. Inside a Scrydon
tool, the same operations are ctx.data.sources.browse and
ctx.data.sources.connectorProfiles. Cortex runs both tools without asking
for approval, because they only read. On that path no per-operation scope is
checked: what a browse may reach is set by the run's grant, by the person's
use of the connection (checked when the run acts for a person), and by the
data source being set up to read through that connection.
Browse
| Field | Type | Meaning |
|---|---|---|
sourceId | string, 1 to 256 characters | The installed data source. |
connectionRef | string, 1 to 256 characters | The connection the data source reads through. |
browse | object | What to list: see below. |
browse.level picks what is listed:
level | Other fields | Returns |
|---|---|---|
schemas | cursor, limit (optional) | schemas: each with name and selectable, plus nextCursor. |
tables | schemaName, and optionally cursor and limit | tables: each with name, selectable, selected, rowCountEstimate, primaryKey, classification and, for a table whose columns look like personal data, personalData. Plus nextCursor. |
columns | schemaName, tableName | columns: each with name, type, nullable, selectable and, when it looks like personal data, personalData. Plus the table's selected, classification, primaryKey, and truncated. |
- Names come in pages.
limitis 1 to 500 and defaults to 100. To read the next page, pass the previous page'snextCursorascursor. AnextCursorofnullmeans there is no next page. - A schema or table name is lowercase. It is a letter or
_, then up to 62 letters, digits or_: the names a data source manifest can select. rowCountEstimateis the database engine's statistic, not a count. It isnullwhere the engine does not expose one.- Personal data is judged from names and types. No row is read to decide it.
The read runs as the person who calls it, in the workspace environment the call is made in. The person must be allowed to use the connection. The data source must be installed in that workspace environment and set up to read through that connection.
Check manifests
| Field | Type | Meaning |
|---|---|---|
sources | array, at most 2,000 | Each entry is { sourceId, manifestSnapshot }. sourceId (1 to 256 characters) names the manifest in the result, and manifestSnapshot is the manifest. |
The result is { profiles, refusals }.
profileshas one entry for each distinct connector profile. ItssourceIdslists every manifest that compiled to it.profilecarries the profile'sversionanddigests, andlineagelists where each column's value is read from.refusalshas one entry for each manifest that did not compile, with itssourceIdand areason:invalid_manifest,incoherent_profileorunpinned_format.issueslists up to 100 problems, each with the fieldpathand amessage.issuesTruncatedistruewhen there were more.
The operation reads nothing of your organization. It compiles only the manifests you send.
@scrydon/sdk/platform exports the bounds (DATA_SOURCE_BROWSE_LIMITS,
CONNECTOR_PROFILES_LIST_LIMITS) and the levels (DATA_SOURCE_BROWSE_LEVEL).
Unknown fields, including an organization or workspace field, are refused.
Errors
| Code | When |
|---|---|
INVALID_REQUEST | The input did not pass validation. A browse was made without a workspace environment. The data source does not read through that connection. |
FORBIDDEN | The person is not allowed to use the connection; the refusal is written to the audit log. Or the data source is not installed in this workspace environment. |
CAPABILITY_NOT_CONFIGURED | The data source is still connecting to its database. |
RATE_LIMITED | The database is busy with other reads. Try again. |
PROVIDER_UNAVAILABLE | The database did not answer, or the person's access could not be checked. |
INTERNAL_ERROR | The refusal could not be recorded. |