Model Historical Runs object schema
The model historical runs object allows you to query information about a model's run history.
The Example query illustrates a few fields you can query with the modelHistoricalRuns
object. Refer to Fields to view the entire schema, which provides all possible fields you can query.
Arguments
When querying for modelHistoricalRuns
, you can use the following arguments:
Field | Type | Required? | Description |
identifier | String | No | The model identifier |
lastRunCount | Int | No | Number of last run results where this model was built to return (max of 20) |
uniqueId | String | No | The unique ID of this model |
withCatalog | Boolean | No | If true, return only runs that have catalog information for this model |
Example query
You can use the environmentId
and the model's uniqueId
to return the model and its execution time for the last 20 times it was run, regardless of which job ran it.
query {
environment(id: 834) {
applied {
modelHistoricalRuns(
uniqueId: "model.marketing.customers" # Use this format for unique ID: RESOURCE_TYPE.PACKAGE_NAME.RESOURCE_NAME
lastRunCount: 20
) {
runId # Get historical results for a particular model
runGeneratedAt
executionTime # View build time across runs
status
tests {
name
status
executeCompletedAt
} # View test results across runs
}
}
}
}
Fields
When querying for modelHistoricalRuns
, you can use the following fields:
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 |
0