Skip to content

Dagster

Dagster assets, runs, checks, partitions and schedules (Dagster+ or OSS)

Connector software
Free and open source
Service credentials
Required
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/dagster/index.md to help me query Dagster with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Compare deployments across your organization

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT deployment_type, count(*) AS deployments
FROM dagster.main.deployments
GROUP BY deployment_type
ORDER BY deployment_type

Quick start

Choose where to run Dagster, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'dagster' AS dagster (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-dagster-worker'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

dagster credentials

Connection to a Dagster instance: open-source dagster-webserver (BASE_URL) or Dagster+.

Get these credentials β†’
secret.sql
CREATE SECRET dagster (
    TYPE dagster,
    api_token    '<API_TOKEN>',  -- secret
    organization '<organization>',
    deployment   '<deployment>',
    base_url     '<base_url>'
);
Credential fields and requirements β†’

4. Run a query

query.sql
SELECT deployment_type, count(*) AS deployments
FROM dagster.main.deployments
GROUP BY deployment_type
ORDER BY deployment_type
More example queries β†’
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'dagster' AS dagster (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-dagster-worker'
);

Overview

Dagster as SQL: assets, materializations, asset checks, partitions, runs, steps, jobs, schedules and sensors from Dagster+ or an open-source dagster-webserver, read through its GraphQL API.

Catalog

Everything dagster exposes once attached β€” read straight from the worker's released build.

dagster 2 schemas
main 14 tables Β· 4 functions

Dagster-native definitions, assets and runs, with filters pushed to Dagster's API.

Schema examples (22)
Examples (22)

How many deployments of each type the organization has

SELECT deployment_type, count(*) AS deployments
FROM dagster.main.deployments
GROUP BY deployment_type
ORDER BY deployment_type;

Every code location and whether it loaded

SELECT location_name, load_status, error_message
FROM dagster.main.code_locations
ORDER BY location_name;

What each repository defines

SELECT location_name, repository_name, job_count, schedule_count
FROM dagster.main.repositories
ORDER BY location_name, repository_name;

Op jobs, how many schedules launch each, and the owning team tag

SELECT job_name, len(schedule_names) AS schedules, tags['team'] AS team
FROM dagster.main.jobs
WHERE NOT is_asset_job
ORDER BY job_name;
18 more examples

Every schedule and whether it is running

SELECT schedule_name, job_name, cron_schedule, status
FROM dagster.main.schedules
ORDER BY schedule_name;

Every sensor, its type and what it launches

SELECT sensor_name, sensor_type, status, target_jobs
FROM dagster.main.sensors
ORDER BY sensor_name;

Resources and how many jobs depend on each

SELECT resource_name, resource_type, len(jobs_using) AS jobs
FROM dagster.main.resources
ORDER BY resource_name;

Pools with steps waiting for a slot

SELECT concurrency_key, slot_count, pending_step_count
FROM dagster.main.concurrency_keys
WHERE pending_step_count > 0
ORDER BY pending_step_count DESC;

Failure counts per job since the start of 2026

SELECT job_name, count(*) FILTER (WHERE status = 'FAILURE') AS failures,
  count(*) AS runs
FROM dagster.main.runs
WHERE created_at >= TIMESTAMPTZ '2026-01-01'
GROUP BY job_name
ORDER BY failures DESC;

The ten slowest successful runs

SELECT run_id, job_name, duration_seconds
FROM dagster.main.runs
WHERE status = 'SUCCESS'
ORDER BY duration_seconds DESC
LIMIT 10;

Assets by staleness: never-materialized ones first

SELECT asset_key, group_name, last_materialized_at
FROM dagster.main.assets
ORDER BY last_materialized_at NULLS FIRST, asset_key;

Partitioned assets with failed partitions

SELECT asset_key, failed_partition_count, partition_count
FROM dagster.main.assets
WHERE is_partitioned AND failed_partition_count > 0
ORDER BY asset_key;

Row counts recorded by each raw_orders materialization since 2026

SELECT materialized_at, run_id,
  CAST(metadata->>'row_count' AS BIGINT) AS row_count
FROM dagster.main.asset_materializations
WHERE asset_key = 'raw_orders' AND materialized_at >= TIMESTAMPTZ '2026-01-01'
ORDER BY materialized_at DESC;

How often each asset has been materialized

SELECT asset_key, count(*) AS materializations,
  max(materialized_at) AS latest
FROM dagster.main.asset_materializations
GROUP BY asset_key
ORDER BY asset_key;

Checks failing on the latest materialization

SELECT asset_key, check_name, latest_severity
FROM dagster.main.asset_checks
WHERE latest_status = 'FAILED'
ORDER BY asset_key, check_name;

Failure rate of each asset check

SELECT asset_key, check_name,
  count(*) FILTER (WHERE NOT passed) AS failures, count(*) AS runs
FROM dagster.main.asset_check_executions
GROUP BY ALL
ORDER BY failures DESC, asset_key;

Partition health per asset

SELECT asset_key, status, count(*) AS partitions
FROM dagster.main.asset_partitions
GROUP BY ALL
ORDER BY asset_key, status;

Partitions of daily_events still to backfill

SELECT partition_key
FROM dagster.main.asset_partitions
WHERE asset_key = 'daily_events' AND status <> 'MATERIALIZED'
ORDER BY partition_index;

Status, job and duration of one run (paste a run id from dagster.main.runs)

SELECT status, job_name, duration_seconds
FROM dagster.main.run('00000000-0000-4000-8000-000000000003');

Status and duration of each step of one run

SELECT step_key, status, duration_seconds
FROM dagster.main.run_step_stats('00000000-0000-4000-8000-000000000003')
ORDER BY step_key;

Which step of a failed run failed, and the root-cause error

SELECT step_key, error_class, error_message
FROM dagster.main.run_events('00000000-0000-4000-8000-000000000003')
WHERE event_type = 'STEP_FAILURE'
ORDER BY step_key;

Run counts per job in the cross-orchestrator status vocabulary

SELECT job_name, dagster.main.unified_run_status(status) AS status,
  count(*) AS runs
FROM dagster.main.runs
GROUP BY ALL
ORDER BY job_name, status;
Tables
asset_check_executions 1 example12 cols

Execution history of every asset check, newest first

Columns
asset_keynot null VARCHAR
Asset the check targets ('a/b').
check_namenot null VARCHAR
Check the execution belongs to (unique per asset).
execution_idnot null VARCHAR
Execution id (event storage id).
run_idnot null VARCHAR
Run that executed the check.
statusnot null VARCHAR
SUCCEEDED, FAILED, EXECUTION_FAILED, IN_PROGRESS or SKIPPED.
executed_atnot null TIMESTAMP WITH TIME ZONE
When the execution was recorded.
partition VARCHAR
Partition the check ran for; NULL when unpartitioned.
step_key VARCHAR
Step that ran the check.
passed BOOLEAN
Evaluation result; NULL when the check did not evaluate.
severity VARCHAR
WARN or ERROR.
description VARCHAR
Evaluation description.
metadata VARCHAR
Evaluation metadata as a JSON object {label: value}; NULL if none.
ConstraintsPRIMARY KEY (asset_key, check_name, execution_id)
Example

Failure rate of each asset check

SELECT asset_key, check_name,
  count(*) FILTER (WHERE NOT passed) AS failures, count(*) AS runs
FROM dagster.main.asset_check_executions
GROUP BY ALL
ORDER BY failures DESC, asset_key;
Link
asset_checks 1 example12 cols

Asset checks and the result of each one's latest execution

Columns
asset_keynot null VARCHAR
Asset the check targets ('a/b').
check_namenot null VARCHAR
Check name, unique per asset.
description VARCHAR
Check description from code.
blockingnot null BOOLEAN
True when a failure blocks downstream materializations.
job_names VARCHAR[]
Jobs that execute the check.
can_execute_individually VARCHAR
CAN_EXECUTE, REQUIRES_MATERIALIZATION or NONE.
latest_execution_id VARCHAR
Execution for the latest materialization; NULL if none.
latest_status VARCHAR
SUCCEEDED, FAILED, EXECUTION_FAILED, IN_PROGRESS or SKIPPED.
latest_run_id VARCHAR
Run that executed the latest check.
latest_executed_at TIMESTAMP WITH TIME ZONE
When the latest execution happened.
latest_severity VARCHAR
WARN or ERROR, from the latest evaluation.
latest_passed BOOLEAN
Whether the latest evaluation passed.
ConstraintsPRIMARY KEY (asset_key, check_name)
Example

Checks failing on the latest materialization

SELECT asset_key, check_name, latest_severity
FROM dagster.main.asset_checks
WHERE latest_status = 'FAILED'
ORDER BY asset_key, check_name;
Link
asset_materializations 2 examples9 cols

Materialization history of every asset, newest first per asset

Columns
asset_keynot null VARCHAR
Materialized asset ('a/b').
materialized_atnot null TIMESTAMP WITH TIME ZONE
When the materialization event was logged.
run_idnot null VARCHAR
Run that materialized the asset.
partition VARCHAR
Partition key; NULL for unpartitioned assets.
step_key VARCHAR
Step that produced the event.
label VARCHAR
Event label.
description VARCHAR
Event description.
tags MAP(VARCHAR, VARCHAR)
Event tags (data version, code version, ...) as a MAP.
metadata VARCHAR
Materialization metadata as a JSON object {label: value}; NULL if none.
Examples (2)

Row counts recorded by each raw_orders materialization since 2026

SELECT materialized_at, run_id,
  CAST(metadata->>'row_count' AS BIGINT) AS row_count
FROM dagster.main.asset_materializations
WHERE asset_key = 'raw_orders' AND materialized_at >= TIMESTAMPTZ '2026-01-01'
ORDER BY materialized_at DESC;

How often each asset has been materialized

SELECT asset_key, count(*) AS materializations,
  max(materialized_at) AS latest
FROM dagster.main.asset_materializations
GROUP BY asset_key
ORDER BY asset_key;
Link
asset_partitions 2 examples4 cols

Every partition of every partitioned asset, with its materialization status

Columns
asset_keynot null VARCHAR
Partitioned asset ('a/b').
partition_keynot null VARCHAR
Partition key; multi-partition keys join dimensions with '|'.
partition_indexnot null INTEGER
Position in the partitions definition (0-based).
statusnot null VARCHAR
MATERIALIZED, FAILED, MATERIALIZING or MISSING.
ConstraintsPRIMARY KEY (asset_key, partition_key)
Examples (2)

Partition health per asset

SELECT asset_key, status, count(*) AS partitions
FROM dagster.main.asset_partitions
GROUP BY ALL
ORDER BY asset_key, status;

Partitions of daily_events still to backfill

SELECT partition_key
FROM dagster.main.asset_partitions
WHERE asset_key = 'daily_events' AND status <> 'MATERIALIZED'
ORDER BY partition_index;
Link
assets 2 examples24 cols

Software-defined assets with lineage, owners, partition counts and latest materialization

Columns
asset_keynot null VARCHAR
Asset key with path parts joined by '/', e.g. 'raw/orders'.
asset_key_pathnot null VARCHAR[]
Asset key path parts.
group_namenot null VARCHAR
Asset group.
description VARCHAR
Asset description from code.
compute_kind VARCHAR
Legacy compute kind tag, e.g. 'python' or 'dbt'.
kinds VARCHAR[]
Kinds (technology tags) declared on the asset.
is_partitionednot null BOOLEAN
True when the asset has a partitions definition.
is_materializablenot null BOOLEAN
False for external/observable-only assets.
is_observablenot null BOOLEAN
True for observable source assets.
has_asset_checksnot null BOOLEAN
True when checks target the asset.
job_names VARCHAR[]
Jobs that can materialize the asset.
dependency_keys VARCHAR[]
Upstream asset keys.
depended_by_keys VARCHAR[]
Downstream asset keys.
owners VARCHAR[]
Owners: user emails, or 'team:<name>'.
tags MAP(VARCHAR, VARCHAR)
Definition tags as a MAP.
repository_namenot null VARCHAR
Repository defining the asset.
location_namenot null VARCHAR
Code location defining the asset.
partition_count INTEGER
Number of partitions in the definition; NULL when unpartitioned.
materialized_partition_count INTEGER
Number of partitions materialized at least once.
failed_partition_count INTEGER
Number of partitions whose latest materialization attempt failed.
materializing_partition_count INTEGER
Number of partitions being materialized right now.
last_materialized_at TIMESTAMP WITH TIME ZONE
Latest materialization time; NULL if never materialized.
last_materialization_run_id VARCHAR
Run of the latest materialization.
urlnot null VARCHAR
Link to the asset in the Dagster UI.
ConstraintsPRIMARY KEY (asset_key)
Examples (2)

Assets by staleness: never-materialized ones first

SELECT asset_key, group_name, last_materialized_at
FROM dagster.main.assets
ORDER BY last_materialized_at NULLS FIRST, asset_key;

Partitioned assets with failed partitions

SELECT asset_key, failed_partition_count, partition_count
FROM dagster.main.assets
WHERE is_partitioned AND failed_partition_count > 0
ORDER BY asset_key;
Link
code_locations 1 example7 cols

Code locations in the Dagster workspace, with load status and errors

Columns
location_namenot null VARCHAR
Code location name.
load_statusnot null VARCHAR
LOADING or LOADED.
updated_at TIMESTAMP WITH TIME ZONE
When the location was last (re)loaded.
is_reload_supported BOOLEAN
Whether the location can be reloaded from the UI.
repository_names VARCHAR[]
Repositories the location serves; empty when it failed to load.
library_versions STRUCT("name" VARCHAR, "version" VARCHAR)[]
Dagster library versions the location runs.
error_message VARCHAR
Load error, when the location failed to load; else NULL.
ConstraintsPRIMARY KEY (location_name)
Example

Every code location and whether it loaded

SELECT location_name, load_status, error_message
FROM dagster.main.code_locations
ORDER BY location_name;
Link
concurrency_keys 1 example8 cols

Concurrency keys (pools) on the instance, with slot usage

Columns
concurrency_keynot null VARCHAR
Concurrency key (pool) name.
slot_countnot null INTEGER
Number of slots configured for the key.
concurrency_limit INTEGER
Configured maximum number of concurrent steps; NULL when unset.
using_default_limit BOOLEAN
True when the instance default applies.
active_slot_countnot null INTEGER
Number of slots currently claimed by running steps.
pending_step_countnot null INTEGER
Number of steps waiting for a slot.
assigned_step_countnot null INTEGER
Number of steps assigned a slot.
active_run_ids VARCHAR[]
Runs holding a slot.
ConstraintsPRIMARY KEY (concurrency_key)
Example

Pools with steps waiting for a slot

SELECT concurrency_key, slot_count, pending_step_count
FROM dagster.main.concurrency_keys
WHERE pending_step_count > 0
ORDER BY pending_step_count DESC;
Link
deployments 1 example3 cols

Deployments in the Dagster+ organization (Dagster+ only)

Columns
deployment_namenot null VARCHAR
Deployment name, e.g. 'prod' or a branch deployment.
deployment_id BIGINT
Dagster+ numeric deployment identifier (not a count).
deployment_type VARCHAR
PRODUCTION, DEV or BRANCH.
ConstraintsPRIMARY KEY (deployment_name)
Example

How many deployments of each type the organization has

SELECT deployment_type, count(*) AS deployments
FROM dagster.main.deployments
GROUP BY deployment_type
ORDER BY deployment_type;
Link
jobs 1 example9 cols

Jobs defined across all repositories, with their schedules and sensors

Columns
job_namenot null VARCHAR
Job name; asset jobs created implicitly are named __ASSET_JOB.
repository_namenot null VARCHAR
Repository (Definitions object) the row belongs to.
location_namenot null VARCHAR
Code location that serves the repository.
job_idnot null VARCHAR
Dagster's opaque job id.
description VARCHAR
Job description from code.
is_asset_jobnot null BOOLEAN
True for jobs that materialize assets.
tags MAP(VARCHAR, VARCHAR)
Job tags as a MAP; read one with tags['team'].
schedule_names VARCHAR[]
Schedules that target the job.
sensor_names VARCHAR[]
Sensors that target the job.
ConstraintsPRIMARY KEY (location_name, repository_name, job_name)
Example

Op jobs, how many schedules launch each, and the owning team tag

SELECT job_name, len(schedule_names) AS schedules, tags['team'] AS team
FROM dagster.main.jobs
WHERE NOT is_asset_job
ORDER BY job_name;
Link
repositories 1 example7 cols

Repositories (Definitions objects) across all code locations

Columns
repository_namenot null VARCHAR
Repository (Definitions object) the row belongs to.
location_namenot null VARCHAR
Code location that serves the repository.
repository_idnot null VARCHAR
Dagster's opaque repository id.
job_countnot null INTEGER
Number of jobs, including implicit asset jobs.
schedule_countnot null INTEGER
Number of schedules.
sensor_countnot null INTEGER
Number of sensors.
asset_groups VARCHAR[]
Asset group names defined in the repository.
ConstraintsPRIMARY KEY (location_name, repository_name)
Example

What each repository defines

SELECT location_name, repository_name, job_count, schedule_count
FROM dagster.main.repositories
ORDER BY location_name, repository_name;
Link
resources 1 example11 cols

Top-level resources and who uses them; configured values are masked

Columns
resource_namenot null VARCHAR
Resource key, as bound in Definitions(resources=...).
repository_namenot null VARCHAR
Repository (Definitions object) the row belongs to.
location_namenot null VARCHAR
Code location that serves the repository.
resource_typenot null VARCHAR
Python class of the resource.
description VARCHAR
Resource description from code.
config_keys VARCHAR[]
Configured field names. Values are never returned (they can be secrets).
env_vars VARCHAR[]
Environment variables the resource's config reads (names only).
asset_keys_using VARCHAR[]
Assets that require the resource, as 'a/b' keys.
jobs_using VARCHAR[]
Jobs whose ops require the resource.
schedules_using VARCHAR[]
Schedules that require the resource.
sensors_using VARCHAR[]
Sensors that require the resource.
ConstraintsPRIMARY KEY (location_name, repository_name, resource_name)
Example

Resources and how many jobs depend on each

SELECT resource_name, resource_type, len(jobs_using) AS jobs
FROM dagster.main.resources
ORDER BY resource_name;
Link
runs 2 examples19 cols

Runs in the deployment, newest first, with filter pushdown

Columns
run_idnot null VARCHAR
Run id (a UUID).
job_namenot null VARCHAR
Job the run executed; __ASSET_JOB for ad-hoc asset materializations.
statusnot null VARCHAR
Dagster run status: QUEUED, NOT_STARTED, STARTING, STARTED, SUCCESS, FAILURE, CANCELING, CANCELED, ...
created_atnot null TIMESTAMP WITH TIME ZONE
When the run was created (submitted).
enqueued_at TIMESTAMP WITH TIME ZONE
When the run entered the run queue; NULL when it was not queued.
started_at TIMESTAMP WITH TIME ZONE
When execution started.
ended_at TIMESTAMP WITH TIME ZONE
When execution finished.
updated_at TIMESTAMP WITH TIME ZONE
Last status change.
duration_seconds DOUBLE
ended_at - started_at in seconds; NULL until the run ends.
trigger VARCHAR
schedule, sensor, event (automation), manual (UI user), other (backfill) or NULL.
tags MAP(VARCHAR, VARCHAR)
Run tags as a MAP, e.g. tags['dagster/schedule_name'].
asset_selection VARCHAR[]
Assets the run targeted, as 'a/b' keys; NULL for op jobs.
steps_succeeded INTEGER
Number of steps that succeeded.
steps_failed INTEGER
Number of steps that failed.
materializations INTEGER
Number of asset materializations the run produced.
root_run_id VARCHAR
First run of a re-execution chain; NULL for an original run.
parent_run_id VARCHAR
Run this one re-executed; NULL for an original run.
mode VARCHAR
Legacy execution mode (always 'default' on current Dagster).
urlnot null VARCHAR
Link to the run in the Dagster UI.
ConstraintsPRIMARY KEY (run_id)
Examples (2)

Failure counts per job since the start of 2026

SELECT job_name, count(*) FILTER (WHERE status = 'FAILURE') AS failures,
  count(*) AS runs
FROM dagster.main.runs
WHERE created_at >= TIMESTAMPTZ '2026-01-01'
GROUP BY job_name
ORDER BY failures DESC;

The ten slowest successful runs

SELECT run_id, job_name, duration_seconds
FROM dagster.main.runs
WHERE status = 'SUCCESS'
ORDER BY duration_seconds DESC
LIMIT 10;
Link
schedules 1 example11 cols

Schedules across all repositories, with cron, state and next tick

Columns
schedule_namenot null VARCHAR
Name the schedule is declared with in code.
repository_namenot null VARCHAR
Repository (Definitions object) the row belongs to.
location_namenot null VARCHAR
Code location that serves the repository.
job_namenot null VARCHAR
Job the schedule launches.
cron_schedulenot null VARCHAR
Cron expression, e.g. '0 6 * * *'.
execution_timezone VARCHAR
Timezone the cron expression is evaluated in.
statusnot null VARCHAR
Current state: RUNNING or STOPPED.
default_statusnot null VARCHAR
Status declared in code: RUNNING or STOPPED.
next_tick_at TIMESTAMP WITH TIME ZONE
Next evaluation time, when the schedule is running.
description VARCHAR
Schedule description from code.
schedule_idnot null VARCHAR
Dagster's opaque schedule id.
ConstraintsPRIMARY KEY (location_name, repository_name, schedule_name)
Example

Every schedule and whether it is running

SELECT schedule_name, job_name, cron_schedule, status
FROM dagster.main.schedules
ORDER BY schedule_name;
Link
sensors 1 example10 cols

Sensors across all repositories, with type, state and targets

Columns
sensor_namenot null VARCHAR
Name the sensor is declared with in code.
repository_namenot null VARCHAR
Repository (Definitions object) the row belongs to.
location_namenot null VARCHAR
Code location that serves the repository.
sensor_typenot null VARCHAR
STANDARD, ASSET, MULTI_ASSET, RUN_STATUS, AUTOMATION, ...
statusnot null VARCHAR
Current state: RUNNING or STOPPED.
default_statusnot null VARCHAR
Status declared in code.
min_interval_secondsnot null INTEGER
Minimum seconds between evaluations.
target_jobs VARCHAR[]
Jobs the sensor can launch.
description VARCHAR
Sensor description from code.
sensor_idnot null VARCHAR
Dagster's opaque sensor id.
ConstraintsPRIMARY KEY (location_name, repository_name, sensor_name)
Example

Every sensor, its type and what it launches

SELECT sensor_name, sensor_type, status, target_jobs
FROM dagster.main.sensors
ORDER BY sensor_name;
Link
Scalar functions
unified_run_status (status VARCHAR) 2 examples

Map a Dagster run status (e.g. 'FAILURE') to queued/running/success/failed/cancelled

Arguments
status VARCHAR
Dagster run status such as 'FAILURE' or 'STARTED'.
ReturnsVARCHAR
Examples (2)

Run counts per job in the cross-orchestrator status vocabulary

SELECT job_name, dagster.main.unified_run_status(status) AS status,
  count(*) AS runs
FROM dagster.main.runs
GROUP BY ALL
ORDER BY job_name, status;
SELECT s, dagster.main.unified_run_status(s) AS status
FROM (VALUES ('FAILURE'), ('CANCELED'), ('STARTING'), ('success')) t(s)
ORDER BY s;
Link
Table functions
run (run_id VARCHAR) 1 example

One run by id, with the same columns as dagster.main.runs (no rows if it does not exist)

Arguments
run_id VARCHAR
Run id as shown in the Dagster UI or in dagster.main.runs.run_id.
Returns columns
run_id VARCHAR
Run id (a UUID).
job_name VARCHAR
Job the run executed; __ASSET_JOB for ad-hoc asset materializations.
status VARCHAR
Dagster run status: QUEUED, NOT_STARTED, STARTING, STARTED, SUCCESS, FAILURE, CANCELING, CANCELED, ...
created_at TIMESTAMP WITH TIME ZONE
When the run was created (submitted).
enqueued_at TIMESTAMP WITH TIME ZONE
When the run entered the run queue; NULL when it was not queued.
started_at TIMESTAMP WITH TIME ZONE
When execution started.
ended_at TIMESTAMP WITH TIME ZONE
When execution finished.
updated_at TIMESTAMP WITH TIME ZONE
Last status change.
duration_seconds DOUBLE
ended_at - started_at in seconds; NULL until the run ends.
trigger VARCHAR
schedule, sensor, event (automation), manual (UI user), other (backfill) or NULL.
tags MAP(VARCHAR, VARCHAR)
Run tags as a MAP, e.g. tags['dagster/schedule_name'].
asset_selection VARCHAR[]
Assets the run targeted, as 'a/b' keys; NULL for op jobs.
steps_succeeded INTEGER
Number of steps that succeeded.
steps_failed INTEGER
Number of steps that failed.
materializations INTEGER
Number of asset materializations the run produced.
root_run_id VARCHAR
First run of a re-execution chain; NULL for an original run.
parent_run_id VARCHAR
Run this one re-executed; NULL for an original run.
mode VARCHAR
Legacy execution mode (always 'default' on current Dagster).
url VARCHAR
Link to the run in the Dagster UI.
Example

Status, job and duration of one run (paste a run id from dagster.main.runs)

SELECT status, job_name, duration_seconds
FROM dagster.main.run('00000000-0000-4000-8000-000000000003');
Link
run_events (run_id VARCHAR) 1 example

The event log of one run, oldest first, paged

Arguments
run_id VARCHAR
Run id as shown in the Dagster UI or in dagster.main.runs.run_id.
Returns columns
run_id VARCHAR
Run id.
event_index BIGINT
0-based position in the run's event log.
timestamp TIMESTAMP WITH TIME ZONE
When the event was logged.
level VARCHAR
Log level: DEBUG, INFO, WARNING, ERROR, CRITICAL.
event_type VARCHAR
DagsterEventType, e.g. STEP_FAILURE; NULL for plain log messages.
event_typename VARCHAR
GraphQL event class, e.g. ExecutionStepFailureEvent.
step_key VARCHAR
Step the event belongs to; NULL for run-level events.
message VARCHAR
Event message.
error_message VARCHAR
Root-cause error message (the user exception), for failure events.
error_class VARCHAR
Root-cause Python exception class, for failure events.
Example

Which step of a failed run failed, and the root-cause error

SELECT step_key, error_class, error_message
FROM dagster.main.run_events('00000000-0000-4000-8000-000000000003')
WHERE event_type = 'STEP_FAILURE'
ORDER BY step_key;
Link
run_step_stats (run_id VARCHAR) 1 example

Per-step status and timing for one run

Arguments
run_id VARCHAR
Run id as shown in the Dagster UI or in dagster.main.runs.run_id.
Returns columns
run_id VARCHAR
Run id.
step_key VARCHAR
Step key (op or asset step).
status VARCHAR
SUCCESS, FAILURE, SKIPPED, IN_PROGRESS, or NULL if it never started.
started_at TIMESTAMP WITH TIME ZONE
Step start.
ended_at TIMESTAMP WITH TIME ZONE
Step end.
duration_seconds DOUBLE
ended_at - started_at in seconds.
attempt_count INTEGER
Attempts made (more than 1 when the step retried).
Example

Status and duration of each step of one run

SELECT step_key, status, duration_seconds
FROM dagster.main.run_step_stats('00000000-0000-4000-8000-000000000003')
ORDER BY step_key;
Link
unified 2 tables

Dagster runs and steps in the shared cross-orchestrator shape.

Schema examples (2)
Examples (2)

Run counts by normalized status

SELECT status, count(*) AS runs
FROM dagster.unified.runs
GROUP BY status
ORDER BY status;

Which steps fail most often

SELECT task_name, count(*) FILTER (WHERE status = 'failed') AS failures
FROM dagster.unified.task_runs
GROUP BY task_name
ORDER BY failures DESC, task_name;
Tables
runs 1 example11 cols

Dagster runs in the shared cross-orchestrator shape

Columns
orchestratornot null VARCHAR
Always 'dagster'.
run_idnot null VARCHAR
Dagster run id.
pipeline VARCHAR
Job name.
statusnot null VARCHAR
queued, running, success, failed, cancelled or skipped.
raw_status VARCHAR
Dagster RunStatus, e.g. FAILURE.
trigger VARCHAR
schedule, manual, sensor, api, event, other or NULL.
queued_at TIMESTAMP WITH TIME ZONE
When the run was created (submitted).
started_at TIMESTAMP WITH TIME ZONE
When execution started.
ended_at TIMESTAMP WITH TIME ZONE
When execution finished.
duration_seconds DOUBLE
ended_at - started_at in seconds.
url VARCHAR
Link to the run in the Dagster UI.
ConstraintsPRIMARY KEY (run_id)
Example

Run counts by normalized status

SELECT status, count(*) AS runs
FROM dagster.unified.runs
GROUP BY status
ORDER BY status;
Link
task_runs 1 example11 cols

Dagster run steps in the shared cross-orchestrator task-run shape

Columns
orchestratornot null VARCHAR
Always 'dagster'.
run_idnot null VARCHAR
Dagster run id.
task_run_idnot null VARCHAR
'<run_id>:<step_key>', unique per step of a run.
task_name VARCHAR
Step key (op or asset step name).
statusnot null VARCHAR
queued, running, success, failed, cancelled or skipped.
raw_status VARCHAR
Dagster StepEventStatus: SUCCESS, FAILURE, SKIPPED, IN_PROGRESS or NULL.
attempt INTEGER
Number of attempts the step made (1 unless it retried).
started_at TIMESTAMP WITH TIME ZONE
When the step started.
ended_at TIMESTAMP WITH TIME ZONE
When the step finished.
duration_seconds DOUBLE
ended_at - started_at in seconds.
url VARCHAR
Link to the step's run in the Dagster UI.
ConstraintsPRIMARY KEY (task_run_id)
Example

Which steps fail most often

SELECT task_name, count(*) FILTER (WHERE status = 'failed') AS failures
FROM dagster.unified.task_runs
GROUP BY task_name
ORDER BY failures DESC, task_name;
Link

Credentials

The secret type dagster declares, as reported by the worker itself.

dagster

How to get these credentials

Connection to a Dagster instance: open-source dagster-webserver (BASE_URL) or Dagster+.

secret.sql
CREATE SECRET dagster (
    TYPE dagster,
    api_token    '<API_TOKEN>',  -- secret
    organization '<organization>',
    deployment   '<deployment>',
    base_url     '<base_url>'
);
Key Type Required Description
api_token secret VARCHAR β€” Dagster+ user or agent token, sent as the Dagster-Cloud-Api-Token header. Leave unset for an open-source dagster-webserver without auth.
organization VARCHAR β€” Dagster+ organization slug: the <org> in https://<org>.dagster.cloud.
deployment VARCHAR β€” Dagster+ deployment name, e.g. 'prod' (the default) or a branch deployment.
base_url VARCHAR β€” Root URL of the Dagster web server, e.g. 'http://localhost:3000' for dagster dev. GraphQL is served at <base_url>/graphql. Overrides organization/deployment.

The worker doesn't mark which keys are required.

Needed by runrun_step_statsrun_events

Create the secret in the same session, after attaching dagster β€” the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

Every code location and whether it loaded

SELECT location_name, load_status, error_message
FROM dagster.main.code_locations
ORDER BY location_name

Uses code_locations

What each repository defines

SELECT location_name, repository_name, job_count, schedule_count
FROM dagster.main.repositories
ORDER BY location_name, repository_name

Uses repositories

Op jobs, how many schedules launch each, and the owning team tag

SELECT job_name, len(schedule_names) AS schedules, tags['team'] AS team
FROM dagster.main.jobs
WHERE NOT is_asset_job
ORDER BY job_name

Uses jobs

Every schedule and whether it is running

SELECT schedule_name, job_name, cron_schedule, status
FROM dagster.main.schedules
ORDER BY schedule_name

Uses schedules

Every sensor, its type and what it launches

SELECT sensor_name, sensor_type, status, target_jobs
FROM dagster.main.sensors
ORDER BY sensor_name

Uses sensors

Resources and how many jobs depend on each

SELECT resource_name, resource_type, len(jobs_using) AS jobs
FROM dagster.main.resources
ORDER BY resource_name

Uses resources

18 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Using the dagster catalog, how many failed runs does each job have?
  • Which partitions of the daily_events asset failed to materialize?
  • Which asset checks failed on their asset's latest materialization?
  • Which job does each Dagster schedule launch, and on what cron?
  • How many times has each asset check been executed, and how often did it fail?
  • What row_count did each materialization of raw_orders record?

Dagster is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.