Files
windmill/backend/migrations/20260801121717_dbt_editor_preview_graph.up.sql
baefa1345b feat: give dbt its own editor with an explicitly refreshed model graph (#10448)
* feat: give dbt its own editor with an explicitly refreshed model graph

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore: bump ee ref for the agent-worker dbt editor graph

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: scope editor graph retention by principal, carry parse context, honor nlang

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore: bump ee ref

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep the dbt editor's model graph and log panel mounted across tabs

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep the dbt_edge to dbt_node joins on an index-usable equality

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: poll a parse until the job ends, resolve the project key, correct the docs

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: surface a slow parse's job, bound poll failures, drop banned bindable defaults

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: hide the dbt Generated UI content, not only its tab

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: honor disabled Triggers in the dbt tab fallback, record permissioned_as

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: one dbt pane with the run drawn on the models, and a full-height script graph

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: move the dbt build arguments behind the Build button

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: trim the dbt editor toolbar and stop the graph asserting a cause it lacks

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: mark dbt as alpha in the language picker and announce it once

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore: trim the dbt alpha notice

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: give a selected dbt model the whole detail section, with a close that deselects

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: close the dbt detail panel by clicking away, and make its close obvious

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: cache the agent-worker dbt query, which needs the private feature to compile

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: never fall back to a settings tab the embedder disabled

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: preview dbt rows from the same project the graph was parsed from

* feat: hide the script-kind selector for dbt projects

* fix: pin a dbt row preview to the project its graph was parsed from

* fix: pin a dbt row preview to the arguments its graph was parsed under

* fix: keep dbt preview placeholders live while its vars stay pinned

* fix: report a warehouse-less dbt parse's counts and flag stale preview args

* fix: tell the pinned-vars case apart from a stale placeholder

* chore: update ee-repo-ref to 59044635769f18f8ff5073236cfc7b5f41e917cc

This commit updates the EE repository reference after PR #707 was merged in windmill-ee-private.

Previous ee-repo-ref: 7e424384cdd4cef8653b55b04f17ad3f801bc50c

New ee-repo-ref: 59044635769f18f8ff5073236cfc7b5f41e917cc

Automated by sync-ee-ref workflow.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
2026-08-03 03:32:08 +02:00

63 lines
3.4 KiB
SQL

-- A graph parsed from the EDITOR's buffer, which names no deployed version.
--
-- The two provenances that existed keyed on one: a version's own graph (the
-- zero-UUID `job_id`) and a run's snapshot of a version. A buffer refresh is
-- neither. It cannot borrow the deployed version's hash — the buffer differs
-- from it, which is the point, and a project being written has no deployed
-- version at all — so `script_hash` becomes NULL and the graph is keyed to the
-- preview job that parsed it, readable only back through that job and never
-- through the path.
--
-- The foreign key to `script` is left exactly as written: it is MATCH SIMPLE,
-- so a NULL in either column satisfies it. A versioned row still dies with its
-- version and a version-less one is simply outside its reach.
--
-- Two partial unique indexes rather than one with NULLS NOT DISTINCT, which
-- needs Postgres 15: a versioned graph is keyed by its version, a buffer parse
-- by its job alone (a preview job id is unique on its own).
ALTER TABLE dbt_node DROP CONSTRAINT dbt_node_pkey;
ALTER TABLE dbt_node ALTER COLUMN script_hash DROP NOT NULL;
CREATE UNIQUE INDEX IF NOT EXISTS dbt_node_versioned_key
ON dbt_node (workspace_id, script_path, script_hash, job_id, unique_id)
WHERE script_hash IS NOT NULL;
CREATE UNIQUE INDEX IF NOT EXISTS dbt_node_editor_key
ON dbt_node (workspace_id, job_id, unique_id)
WHERE script_hash IS NULL;
ALTER TABLE dbt_edge DROP CONSTRAINT dbt_edge_pkey;
ALTER TABLE dbt_edge ALTER COLUMN script_hash DROP NOT NULL;
CREATE UNIQUE INDEX IF NOT EXISTS dbt_edge_versioned_key
ON dbt_edge (workspace_id, script_path, script_hash, job_id, parent_unique_id, child_unique_id)
WHERE script_hash IS NOT NULL;
CREATE UNIQUE INDEX IF NOT EXISTS dbt_edge_editor_key
ON dbt_edge (workspace_id, job_id, parent_unique_id, child_unique_id)
WHERE script_hash IS NULL;
ALTER TABLE dbt_graph_snapshot DROP CONSTRAINT dbt_graph_snapshot_pkey;
ALTER TABLE dbt_graph_snapshot ALTER COLUMN script_hash DROP NOT NULL;
CREATE UNIQUE INDEX IF NOT EXISTS dbt_graph_snapshot_versioned_key
ON dbt_graph_snapshot (workspace_id, script_path, script_hash, job_id)
WHERE script_hash IS NOT NULL;
CREATE UNIQUE INDEX IF NOT EXISTS dbt_graph_snapshot_editor_key
ON dbt_graph_snapshot (workspace_id, job_id)
WHERE script_hash IS NULL;
-- On an EDITOR graph only: the principal whose parse wrote it.
--
-- Retention for these is a count per script rather than a clock, and the scope
-- has to be something the caller cannot choose. A preview's path IS the
-- caller's to choose and needs only `jobs:run`, so bounding by path alone would
-- let one caller's parses evict the graphs of whoever is actually editing that
-- script. `permissioned_as` is the execution principal the queue derived, which
-- is the same reason `dbt_run_state` keys on it.
ALTER TABLE dbt_graph_snapshot ADD COLUMN IF NOT EXISTS permissioned_as VARCHAR(255);
-- An editor graph is bounded per (path, principal) rather than by age: the
-- newest few are kept and the rest dropped as each refresh lands, so this is the
-- index that ordering reads. The instance-wide age sweep every dbt run already
-- performs (`job_id <> DEPLOYED_GRAPH`) still catches one refreshed once and
-- left.
CREATE INDEX IF NOT EXISTS idx_dbt_graph_snapshot_editor_path
ON dbt_graph_snapshot (workspace_id, script_path, permissioned_as, ingested_at)
WHERE script_hash IS NULL;