Skip to main content

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.

FieldTypeRequired?Description
databaseStringNoThe database where this table/view lives
identifierStringNoThe identifier of this table/view
schemaStringNoThe 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:

FieldTypeDescription
accountIdBigInt!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
commentStringThe comment on this source
criteriaCriteria!The freshness SLA specified for this source table
databaseStringThe database this source is defined in
dbtVersionStringThe version of dbt used to produce this node
descriptionStringThe user-supplied description for this node
environmentIdBigInt!The unique ID of the account in dbt Cloud that this node was generated for
freshnessCheckedBooleanWhether or not the freshness was checked
identifierStringThe identifier of this table/view
jobIdBigInt!The unique ID of the account in dbt Cloud that this node was generated for
loaderStringThe loader of this source
maxLoadedAtDateTimeThe max value in the designated "loaded_at" column for this source table. ISO formatted timestamp
maxLoadedAtTimeAgoInSFloatThe delta (in seconds) between max_loaded_at and snapshotted_at
metaJSONObjectThe key-value store containing metadata relevant to this node
nameStringThe user-supplied name of this particular node
ownerStringThe owner of this source
projectIdBigInt!The unique ID of the account in dbt Cloud that this node was generated for
resourceTypeString!The resource type of this node
runElapsedTimeFloatThe elapsed time of the specific run step (dbt source snapshot-freshness) that generated this source node
runGeneratedAtDateTimeThe timestamp when the run step (dbt source snapshot-freshness) was completed, ISO formatted timestamp
runIdBigInt!The unique ID of the account in dbt Cloud that this node was generated for
schemaStringThe schema this source is defined in
snapshottedAtDateTimeThe time when this source was checked for freshnesses by dbt. ISO formatted timestamp
sourceDescriptionStringThe user-supplied description for this source
sourceNameStringThe logical name of this source
stateFreshnessStatusThe 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.
typeStringThe type of this source
uniqueIdString!The unique ID of this node
0