Model object schema
The model object allows you to query information about a particular model in a given job.
Arguments
When querying for a model
, the following arguments are available.
Field | Type | Required? | Description |
uniqueId | String! | Yes | No description provided |
Below we show some illustrative example queries and outline the schema (all possible fields you can query) of the model object.
Example query for finding parent models and sources
The example query below uses the parentsModels
and parentsSources
fields to fetch information about a model’s parent models and parent sources. The jobID and uniqueID fields are placeholders that you will need to replace with your own values.
{
job(id: 123) {
model(uniqueId: "model.jaffle_shop.dim_user") {
parentsModels {
runId
uniqueId
executionTime
}
parentsSources {
runId
uniqueId
state
}
}
}
}
Example query for model timing
The example query below could be useful if you want to understand information around execution timing on a given model (start, end, completion).
{
job(id: 123) {
model(uniqueId: "model.jaffle_shop.dim_user") {
runId
projectId
name
uniqueId
resourceType
executeStartedAt
executeCompletedAt
executionTime
}
}
}
Example query for column-level information
You can use the following example query to understand more about the columns of a given model. This query will only work if the job has generated documentation; that is, it will work with the command dbt docs generate
.
{
job(id: 123) {
model(uniqueId: "model.jaffle_shop.dim_user") {
columns {
name
index
type
comment
description
tags
meta
}
}
}
}
Fields
When querying for a model
, 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 |