This document covers the key GraphQL queries used to retrieve asset data, run information, and event streaming in Dagster. These queries form the foundation of the Dagster UI's data layer and provide programmatic access to asset metadata, execution history, and real-time status information.
For information about the overall GraphQL schema structure, see GraphQL API. For details about code location and event management interfaces, see Code Location and Event Management.
The asset and run query system is built around several core GraphQL types and resolvers that provide access to Dagster's execution state and asset metadata.
Sources: python_modules/dagster-graphql/dagster_graphql/schema/roots/query.py214-579
The query resolution layer maps GraphQL query fields to implementation functions in the dagster_graphql.implementation module.
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_assets.py96-142 python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py40-251 python_modules/dagster-graphql/dagster_graphql/implementation/external.py25-91
Asset queries provide access to asset definitions, materialization history, and current status information.
The primary asset queries include:
| Query Field | Purpose | Return Type |
|---|---|---|
assetsOrError | Retrieve multiple assets with pagination | AssetConnection |
assetOrError | Retrieve a single asset by key | Asset |
assetNodes | Retrieve asset nodes (definitions) | [AssetNode!]! |
assetNodeOrError | Retrieve a single asset node by key | AssetNode |
Sources: python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_assets.py71-86
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_assets.py206-219
Asset materialization queries provide access to execution history and lineage information:
Sources: python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_assets.py105-124
The assetEventHistory field provides comprehensive event tracking:
Sources: python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_assets.py160-199
Asset nodes provide definition-level information including dependencies, partitioning, and metadata:
Sources: python_modules/dagster-graphql/dagster_graphql/schema/asset_graph.py249-359
Run queries provide access to execution information, including run status, logs, and statistics.
| Query Field | Purpose | Return Type |
|---|---|---|
runsOrError | Retrieve multiple runs with filtering | [Run!]! |
runOrError | Retrieve a single run by ID | Run |
runGroupOrError | Retrieve a group of related runs | RunGroup |
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py110-127
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py40-50
Run queries can include detailed statistics and event information:
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py253-326
These queries provide access to current execution state and real-time updates.
The assetsLatestInfo query provides current status for multiple assets:
Sources: python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_assets.py265-297
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py169-251
The runs feed provides paginated access to execution history:
Sources: python_modules/dagster-graphql/dagster_graphql/schema/roots/query.py392-405
Workspace queries provide access to code location metadata, repository definitions, and workspace structure.
| Query Field | Purpose | Return Type |
|---|---|---|
workspaceOrError | Retrieve complete workspace structure | GrapheneWorkspace |
repositoriesOrError | Retrieve all repositories | GrapheneRepositoryConnection |
repositoryOrError | Retrieve a single repository | GrapheneRepository |
locationStatusesOrError | Retrieve code location status entries | GrapheneWorkspaceLocationStatusEntriesOrError |
workspaceLocationEntryOrError | Retrieve a workspace entry by name | GrapheneWorkspaceLocationEntry |
Sources: python_modules/dagster-graphql/dagster_graphql/schema/roots/query.py237-240 python_modules/dagster-graphql/dagster_graphql/implementation/external.py25-32
The repositoryOrError query retrieves a single repository with its definitions:
Sources: python_modules/dagster-graphql/dagster_graphql/schema/roots/query.py231-235 python_modules/dagster-graphql/dagster_graphql/implementation/external.py40-53
Location status queries provide real-time information about code location health:
Sources: python_modules/dagster-graphql/dagster_graphql/schema/roots/query.py242-245 python_modules/dagster-graphql/dagster_graphql/implementation/external.py18-24
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/external.py25-32 python_modules/dagster/dagster/_core/workspace/context.py134-160 python_modules/dagster/dagster/_core/remote_representation/external.py96-151
Asset health queries provide information about asset freshness, checks, and overall health status.
Sources: python_modules/dagster-graphql/dagster_graphql/schema/asset_health.py1-170 js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql1122-1171
Sources: python_modules/dagster-graphql/dagster_graphql/schema/pipelines/pipeline.py462-468 js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql1122-1171
The assetCheckExecutions query retrieves execution history for asset checks:
Sources: python_modules/dagster-graphql/dagster_graphql/schema/roots/query.py443-457 python_modules/dagster-graphql/dagster_graphql/implementation/fetch_asset_checks.py1-142
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_asset_checks.py20-89
| Type | Python Class | Purpose | Key Fields |
|---|---|---|---|
Asset | GrapheneAsset | Runtime asset with materialization data | key, assetMaterializations, assetObservations, assetHealth |
AssetNode | GrapheneAssetNode | Asset definition with metadata | assetKey, dependencies, partitionDefinition, jobs |
MaterializationEvent | GrapheneMaterializationEvent | Asset materialization record | assetKey, timestamp, assetLineage, metadataEntries |
ObservationEvent | GrapheneObservationEvent | Asset observation record | assetKey, timestamp, metadataEntries |
AssetHealth | GrapheneAssetHealth | Asset health status | assetHealth, materializationStatus, assetChecksStatus, freshnessStatus |
| Type | Python Class | Purpose | Key Fields |
|---|---|---|---|
Run | GrapheneRun | Execution run | runId, status, stepStats, assets, stats |
RunStatsSnapshot | GrapheneRunStatsSnapshot | Run execution statistics | stepsSucceeded, stepsFailed, materializations, expectations |
RunStepStats | GrapheneRunStepStats | Individual step statistics | stepKey, status, startTime, endTime, materializations |
RunGroup | GrapheneRunGroup | Related runs | rootRunId, runs |
| Type | Python Class | Purpose | Key Fields |
|---|---|---|---|
Workspace | GrapheneWorkspace | Complete workspace | locationEntries |
WorkspaceLocationEntry | GrapheneWorkspaceLocationEntry | Code location entry | name, loadStatus, locationOrLoadError |
Repository | GrapheneRepository | Repository definition | name, pipelines, schedules, sensors, assetGroups |
RepositoryLocation | GrapheneRepositoryLocation | Code location | name, repositories, isReloadSupported |
Sources: js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql606-756 js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts101-602 python_modules/dagster-graphql/dagster_graphql/schema/pipelines/pipeline.py258-296 python_modules/dagster-graphql/dagster_graphql/schema/asset_graph.py231-344 python_modules/dagster-graphql/dagster_graphql/schema/external.py1-350
Most collection queries support pagination through cursor and limit parameters. The system uses cursors to efficiently page through large result sets.
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_assets.py66-93 python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py110-127
The GraphQL layer uses RepositoryScopedBatchLoader to batch and deduplicate queries to the underlying data store:
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/loader.py1-400
Query results are cached at multiple levels:
| Cache Layer | Implementation | Purpose |
|---|---|---|
| Asset Records | AssetRecord.blocking_get_many | Cache asset materialization data |
| Run Records | RunRecord.gen | Cache run execution data |
| Asset Graph | RemoteAssetGraph | Cache asset dependency graph |
| Dynamic Partitions | CachingDynamicPartitionsLoader | Cache dynamic partition keys |
| Stale Status | CachingStaleStatusResolver | Cache asset staleness calculations |
Sources: python_modules/dagster/dagster/_core/storage/event_log/base.py1-300 python_modules/dagster/dagster/_core/instance/types.py1-200 python_modules/dagster/dagster/_core/workspace/context.py162-184
This document covers the key GraphQL queries used to retrieve asset data, run information, and event streaming in Dagster. These queries form the foundation of the Dagster UI's data layer and provide programmatic access to asset metadata, execution history, and real-time status information.
For information about the overall GraphQL schema structure, see GraphQL API. For details about code location and event management interfaces, see Code Location and Event Management.
The asset and run query system is built around several core GraphQL types and resolvers that provide access to Dagster's execution state and asset metadata.
Sources: python_modules/dagster-graphql/dagster_graphql/schema/roots/query.py214-579
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_assets.py96-142 python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py169-251
Asset queries provide access to asset definitions, materialization history, and current status information.
The primary asset queries include:
| Query Field | Purpose | Return Type |
|---|---|---|
assetsOrError | Retrieve multiple assets with pagination | AssetConnection |
assetOrError | Retrieve a single asset by key | Asset |
assetNodes | Retrieve asset nodes (definitions) | [AssetNode!]! |
assetNodeOrError | Retrieve a single asset node by key | AssetNode |
Sources: python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_assets.py71-86
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_assets.py206-219
Asset materialization queries provide access to execution history and lineage information:
Sources: python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_assets.py105-124
The assetEventHistory field provides comprehensive event tracking:
Sources: python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_assets.py160-199
Asset nodes provide definition-level information including dependencies, partitioning, and metadata:
Sources: python_modules/dagster-graphql/dagster_graphql/schema/asset_graph.py249-359
Run queries provide access to execution information, including run status, logs, and statistics.
| Query Field | Purpose | Return Type |
|---|---|---|
runsOrError | Retrieve multiple runs with filtering | [Run!]! |
runOrError | Retrieve a single run by ID | Run |
runGroupOrError | Retrieve a group of related runs | RunGroup |
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py110-127
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py40-50
Run queries can include detailed statistics and event information:
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py253-326
These queries provide access to current execution state and real-time updates.
The assetsLatestInfo query provides current status for multiple assets:
Sources: python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_assets.py265-297
Sources: python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py169-251
The runs feed provides paginated access to execution history:
Sources: python_modules/dagster-graphql/dagster_graphql/schema/roots/query.py392-405
| Type | Purpose | Key Fields |
|---|---|---|
Asset | Runtime asset with materialization data | key, assetMaterializations, assetObservations |
AssetNode | Asset definition with metadata | assetKey, dependencies, partitionDefinition |
MaterializationEvent | Asset materialization record | assetKey, timestamp, assetLineage |
ObservationEvent | Asset observation record | assetKey, timestamp, metadataEntries |
| Type | Purpose | Key Fields |
|---|---|---|
Run | Execution run | runId, status, stepStats, assets |
RunStatsSnapshot | Run execution statistics | stepsSucceeded, stepsFailed, materializations |
RunStepStats | Individual step statistics | stepKey, status, startTime, endTime |
Sources: js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql606-756 js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts101-602
Refresh this wiki