Environment object schema
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.
Field | Type | Required? | Description |
id | BigInt! | Yes | The environment id for this model |
userId | BigInt | No | UserId for a development environment |
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.
Field | Type | Description |
adapterType | String | The adapter type (data platform) that this environment executed with |
applied | AppliedState | |
consumerProjects | [ConsumerProject!]! | Projects that depend on the current environment |
dbtProjectName | String | The project name for this environment |
definition | DefinitionState | |
modelQueryHistoryState | ModelQueryHistoryState! | State of model query history for the environment |
producerProjects | [ProducerProject!]! | Projects depended on by the current environment |
searchResults | EnvironmentSearchResults_Connection! | The results of the query. |
selectorAutocomplete | [AutocompleteResult!]! |
When querying the applied
field of environment
, you can use the following fields.
Field | Type | Description |
exposureTile | ExposureTileNode | An exposure tile in this environment |
exposures | ExposureAppliedStateNodeConnection! | |
lastUpdatedAt | DateTime | The timestamp when the environment was last updated, which is when the run was ingested. |
latestGitSha | String | The git sha of the project when the applied state was last updated. |
latestIssues | AppliedStateLatestIssuesConnection! | The most recent issues found in the environment |
lineage | [!]! | Project Lineage. |
modelHistoricalRuns | [ModelNode!]! | Retrieve model information based on environmentId. This will include any run from any job in the specified environment. |
models | ModelAppliedStateNodeConnection! | |
owners | [ExposureOwner!]! | |
packages | [String!]! | List of packages used in the environment |
recentResourceChanges | AppliedStateRecentResourceChangesConnection! | The most recent changes to resources in the environment, bucketed by day |
resourceCounts | JSONObject | The project name for this environment |
resources | EnvironmentAppliedNodeConnection! | The paginated results of resources. |
searchResults | AppliedStateSearchResults_Connection! | The results of the query. |
seeds | SeedAppliedStateNodeConnection! | |
snapshots | SnapshotAppliedStateNodeConnection! | |
sources | SourceAppliedStateNodeConnection! | |
tags | [Tag!]! | The distinct tags of applied resources in the environment |
tests | TestAppliedStateNodeConnection! | The definition state of a test |
typeahead | AppliedStateTypeaheadConnection | |
veSearch | AppliedStateVeSearchConnection |
When querying the definition
field of environment
, you can use the following fields.
Field | Type | Description |
exposures | ExposureDefinitionNodeConnection! | The paginated results of Exposures. |
groups | GroupNodeConnection! | Groups for model governance. |
lastUpdatedAt | DateTime | The timestamp when the environment was last updated, which is when the run was ingested. |
lineage | [!]! | Project Lineage. |
macros | MacroDefinitionNodeConnection! | |
metrics | MetricDefinitionNodeConnection! | |
models | ModelDefinitionNodeConnection! | |
packages | [String!]! | List of packages used in the environment |
resourceCounts | JSONObject | The project name for this environment |
resources | EnvironmentDefinitionNodeConnection! | The paginated results of resources. |
savedQueries | SavedQueryDefinitionNodeConnection! | |
seeds | SeedDefinitionNodeConnection! | |
semanticModels | SemanticModelDefinitionNodeConnection! | |
snapshots | SnapshotDefinitionNodeConnection! | |
sources | SourceDefinitionNodeConnection! | |
tags | [Tag!]! | The distinct tags of definition resources in the environment |
tests | TestDefinitionNodeConnection! |