Skip to main content

Model

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. Note that if you do not include a runId, it will default to the most recent run of the specified job:

Fetching data...

Below we show some illustrative example queries and outline the schema (all possible fields you can query) of this model object.

Example Queries

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. Note that we put a placeholder jobID and uniqueID, which you will have to replace.

{
model(jobId: 123, uniqueId: "model.jaffle_shop.dim_user") {
parentsModels {
runId
uniqueId
executionTime
}
parentsSources {
runId
uniqueId
state
}
}
}

Model Timing

The example query below could be useful if we wanted to understand information around execution timing on a given model (start, end, completion).

{
model(jobId: 123, uniqueId: "model.jaffle_shop.dim_user") {
runId
projectId
name
uniqueId
resourceType
executeStartedAt
executeCompletedAt
executionTime
}
}

Column-level information

You can use the following example query to understand more about the columns of a given model. Note that this will only work if the job has generated documentation. For example it will work with the command dbt docs generate.

{
model(jobId: 123, 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:

Fetching data...

0