Skip to main content

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.

FieldTypeRequired?Description
uniqueIdString!YesNo 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:

FieldTypeDescription
accessStringThe access level of this model
accountIdBigInt!The unique ID of the account in dbt Cloud that this node was generated for
aliasStringThe alias of this model
argsStringThe 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
commentStringThe comment on this model
compileCompletedAtDateTimeThe ISO timestamp when the model compilation started
compileStartedAtDateTimeThe ISO timestamp when the model compilation started
compiledCodeStringThe compiled code of this model
compiledSqlStringThe compiled sql of this model
databaseStringThe database this model is defined in
dbtGroupStringThe dbt group id of this model
dbtVersionStringThe version of dbt used to produce this node
dependsOn[String!]!The list of nodes this model depends on
descriptionStringThe user-supplied description for this node
environmentIdBigInt!The unique ID of the account in dbt Cloud that this node was generated for
errorStringThe error message if there was an error else null
executeCompletedAtDateTimeThe ISO timestamp when the model execution completed
executeStartedAtDateTimeThe ISO timestamp when the model execution started
executionTimeFloatThe total time elapsed during the execution of this model
invocationIdStringThe identifier of the run step that generated this model
jobIdBigInt!The unique ID of the account in dbt Cloud that this node was generated for
languageStringThe language of this model
materializedTypeStringThe materialized type of this model
metaJSONObjectThe key-value store containing metadata relevant to this node
nameStringThe user-supplied name of this particular node
ownerStringThe owner of this model
packageNameStringThe package name of this model
packages[String!]The packages of this model
parentsModels[ModelNode!]!Retrieve parents information.
parentsSources[SourceNode!]!Retrieve parents source information.
projectIdBigInt!The unique ID of the account in dbt Cloud that this node was generated for
rawCodeStringThe raw code of this model
rawSqlStringThe raw sql of this model
resourceTypeString!The resource type of this node
runElapsedTimeFloatThe elapsed time of the specific run step (dbt run) that generated this model node
runGeneratedAtDateTimeThe timestamp when the run step (dbt run) was completed, ISO formatted timestamp
runIdBigInt!The unique ID of the account in dbt Cloud that this node was generated for
runResults[RunInfoNode!]!The run results of this model
schemaStringThe schema this model is defined in
skipBooleanWhether this model was skipped
stats[CatalogStat!]!The stats of this model
statusStringThe database reported status of this model
tags[String!]The tags associated with this node
tests[TestNode!]!Retrieve test information.
threadIdStringThe thread that ran the execution of this model
typeStringThe type of this model
uniqueIdString!The unique ID of this node
0