Sources object schema
The sources object allows you to query information about all sources in a given job.
Arguments
When querying for sources
, the following arguments are available.
Field | Type | Required? | Description |
database | String | No | The database where this table/view lives |
identifier | String | No | The identifier of this table/view |
schema | String | No | The schema where this table/view lives |
Below we show some illustrative example queries and outline the schema of the sources object.
Example queries
The database, schema, and identifier arguments are optional. This means that with this endpoint you can:
- Find a specific source by providing
<database>.<schema>.<identifier>
- Find all of the sources in a database and/or schema by providing
<database>
and/or<schema>
Finding sources by their database, schema, and identifier
The example query below finds a source by its unique database, schema, and identifier.
{
job(id: 123) {
sources(
database: "analytics"
schema: "analytics"
identifier: "dim_customers"
) {
uniqueId
}
}
}
Finding sources by their schema
The example query below finds all sources in this schema and their respective states (pass, error, fail).
{
job(id: 123) {
sources(schema: "analytics") {
uniqueId
state
}
}
}
Fields
The sources object can access the same fields as the source node. The difference is that the sources object can output a list so instead of querying for fields for one specific source, you can query for those parameters for all sources within a jobID, database, and so on.
When querying for sources
, the following fields are available:
Field | Type | Description |
accountId | BigInt! | The unique ID of the account in dbt Cloud that this node was generated for |
childrenL1 | [String!]! | The list of nodes that depend on this source |
columns | [CatalogColumn!] | The columns of this source |
comment | String | The comment on this source |
criteria | Criteria! | The freshness SLA specified for this source table |
database | String | The database this source is defined in |
dbtVersion | String | The version of dbt used to produce this node |
description | String | The user-supplied description for this node |
environmentId | BigInt! | The unique ID of the account in dbt Cloud that this node was generated for |
freshnessChecked | Boolean | Whether or not the freshness was checked |
identifier | String | The identifier of this table/view |
jobId | BigInt! | The unique ID of the account in dbt Cloud that this node was generated for |
loader | String | The loader of this source |
maxLoadedAt | DateTime | The max value in the designated "loaded_at" column for this source table. ISO formatted timestamp |
maxLoadedAtTimeAgoInS | Float | The delta (in seconds) between max_loaded_at and snapshotted_at |
meta | JSONObject | The key-value store containing metadata relevant to this node |
name | String | The user-supplied name of this particular node |
owner | String | The owner of this source |
projectId | BigInt! | The unique ID of the account in dbt Cloud that this node was generated for |
resourceType | String! | The resource type of this node |
runElapsedTime | Float | The elapsed time of the specific run step (dbt source snapshot-freshness) that generated this source node |
runGeneratedAt | DateTime | The timestamp when the run step (dbt source snapshot-freshness) was completed, ISO formatted timestamp |
runId | BigInt! | The unique ID of the account in dbt Cloud that this node was generated for |
schema | String | The schema this source is defined in |
snapshottedAt | DateTime | The time when this source was checked for freshnesses by dbt. ISO formatted timestamp |
sourceDescription | String | The user-supplied description for this source |
sourceName | String | The logical name of this source |
state | FreshnessStatus | The state of the freshness check for this source. Can be one of null, "pass", "fail", or "error". A value of null indicates that there was no freshness check. |
stats | [CatalogStat!]! | The stats of this source |
tags | [String!] | The tags associated with this node |
tests | [TestNode!]! | Retrieve test information. |
type | String | The type of this source |
uniqueId | String! | The unique ID of this node |