Skip to main content

Environment object schema

Public Preview

This feature is currently in Public Preview and subject to change. If you want to provide feedback, please contact us.

The environment object allows you to query information about a particular model based on environmentId.

The Example queries illustrate a few fields you can query with this environment object. Refer to Fields to view the entire schema, which provides all possible fields you can query.

Arguments

When querying for environment, you can use the following arguments.

Fetching data...

Example queries

You can use your production environment's id:

query Example {
environment(id: 834){ # Get the latest state of the production environment
applied { # The state of an executed node as it exists as an object in the database
models(first: 100){ # Pagination to ensure manageable response for large projects
edges { node {
uniqueId, name, description, rawCode, compiledCode, # Basic properties
database, schema, alias, # Table/view identifier (can also filter by)
executionInfo {executeCompletedAt, executionTime}, # Metadata from when the model was built
tests {name, executionInfo{lastRunStatus, lastRunError}}, # Latest test results
catalog {columns {name, description, type}, stats {label, value}}, # Catalog info
ancestors(types:[Source]) {name, ...on SourceAppliedStateNode {freshness{maxLoadedAt, freshnessStatus}}}, # Source freshness }
children {name, resourceType}}} # Immediate dependencies in lineage
totalCount } # Number of models in the project
}
definition { # The logical state of a given project node given its most recent manifest generated
models(first: 100, filter:{access:public}){ # Filter on model access (or other properties)
edges { node {
rawCode, # Compare to see if/how the model has changed since the last build
jobDefinitionId, runGeneratedAt, # When the code was last compiled or run
contractEnforced, group, version}}} # Model governance
}
}

With the deprecation of the data type Int for id, below is an example of replacing it with BigInt:

query ($environmentId: BigInt!, $first: Int!) {
environment(id: $environmentId) {
applied {
models(first: $first) {
edges {
node {
uniqueId
executionInfo {
lastRunId
}
}
}
}
}
}
}

With the deprecation of modelByEnvironment, below is an example of replacing it with environment:

query ($environmentId: BigInt!, $uniqueId: String) {
environment(id: $environmentId) {
applied {
modelHistoricalRuns(uniqueId: $uniqueId) {
uniqueId
executionTime
executeCompletedAt
}
}
}
}

Fields

When querying an environment, you can use the following fields.

Fetching data...

When querying the applied field of environment, you can use the following fields.

Fetching data...

When querying the definition field of environment, you can use the following fields.

Fetching data...

0