Models object schema
The models object allows you to query information about all models in a given job.
Arguments
When querying for models
, 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 models object.
Example queries
The database, schema, and identifier arguments are all optional. This means that with this endpoint you can:
- Find a specific model by providing
<database>.<schema>.<identifier>
- Find all of the models in a database and/or schema by providing
<database>
and/or<schema>
Find models by their database, schema, and identifier
The example query below finds a model by its unique database, schema, and identifier.
{
job(id: 123) {
models(database:"analytics", schema: "analytics", identifier:"dim_customers") {
uniqueId
}
}
}
Find models by their schema
The example query below finds all models in this schema and their respective execution times.
{
job(id: 123) {
models(schema: "analytics") {
uniqueId
executionTime
}
}
}
Fields
The models object can access the same fields as the Model node. The difference is that the models object can output a list so instead of querying for fields for one specific model, you can query for those parameters for all models within a jobID, database, and so on.
When querying for models
, the following fields are available:
Field | Type | Description |
access | String | The access level of this model |
accountId | BigInt! | The unique ID of the account in dbt Cloud that this node was generated for |
alias | String | The alias of this model |
args | String | The args passed to the dbt step which generated this model |
childrenL1 | [String!]! | The list of nodes that depend on this model |
columns | [CatalogColumn!] | The columns of this model |
comment | String | The comment on this model |
compileCompletedAt | DateTime | The ISO timestamp when the model compilation started |
compileStartedAt | DateTime | The ISO timestamp when the model compilation started |
compiledCode | String | The compiled code of this model |
compiledSql | String | The compiled sql of this model |
database | String | The database this model is defined in |
dbtGroup | String | The dbt group id of this model |
dbtVersion | String | The version of dbt used to produce this node |
dependsOn | [String!]! | The list of nodes this model depends on |
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 |
error | String | The error message if there was an error else null |
executeCompletedAt | DateTime | The ISO timestamp when the model execution completed |
executeStartedAt | DateTime | The ISO timestamp when the model execution started |
executionTime | Float | The total time elapsed during the execution of this model |
invocationId | String | The identifier of the run step that generated this model |
jobId | BigInt! | The unique ID of the account in dbt Cloud that this node was generated for |
language | String | The language of this model |
materializedType | String | The materialized type of this model |
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 model |
packageName | String | The package name of this model |
packages | [String!] | The packages of this model |
parentsModels | [ModelNode!]! | Retrieve parents information. |
parentsSources | [SourceNode!]! | Retrieve parents source information. |
projectId | BigInt! | The unique ID of the account in dbt Cloud that this node was generated for |
rawCode | String | The raw code of this model |
rawSql | String | The raw sql of this model |
resourceType | String! | The resource type of this node |
runElapsedTime | Float | The elapsed time of the specific run step (dbt run) that generated this model node |
runGeneratedAt | DateTime | The timestamp when the run step (dbt run) was completed, ISO formatted timestamp |
runId | BigInt! | The unique ID of the account in dbt Cloud that this node was generated for |
runResults | [RunInfoNode!]! | The run results of this model |
schema | String | The schema this model is defined in |
skip | Boolean | Whether this model was skipped |
stats | [CatalogStat!]! | The stats of this model |
status | String | The database reported status of this model |
tags | [String!] | The tags associated with this node |
tests | [TestNode!]! | Retrieve test information. |
threadId | String | The thread that ran the execution of this model |
type | String | The type of this model |
uniqueId | String! | The unique ID of this node |