feat(warehouse-saved-query): manage warehouse saved queries as code - #99
Open
pl wants to merge 3 commits into
Open
feat(warehouse-saved-query): manage warehouse saved queries as code#99pl wants to merge 3 commits into
pl wants to merge 3 commits into
Conversation
Add warehouse_saved_queries list/create/retrieve/partial_update/destroy to the openapi-filter allowlist and regenerate src/generated/api.d.ts. PUT (update) is omitted — the client uses PATCH; materialize/run/cancel stay imperative and are out of scope for the resource. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Manage warehouse saved queries (projects/{id}/warehouse_saved_queries) as code.
Natural key is `name` (the HogQL table name, unique); identity + hash ride a
trailing HTML-comment marker in `description` (round-trips, PATCH-rewritable).
Model = name/query/description/folder_id.
Novel piece — optimistic-concurrency read-then-write: the server guards `query`
writes with an edit token, so an update refetches the row (also re-asserting the
identity marker) and echoes the current `latest_history_id` as
`edited_history_id`, or the PATCH 400s as a conflicting edit. Description-only
writes (tag-back) skip the token. Materialization (`sync_frequency`,
run/cancel/materialize) is DAG-managed and left out of scope (direct
`sync_frequency` PATCH 400s). Real DELETE (204). The list endpoint returns a
minimal serializer without `query`, so pull hydrates the full row before render.
Includes pull codegen (+ hydrateForPull), unit tests, two examples, README
scope (warehouse_view:read/write), resources.md row.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Seed one saved query per smoke run (underscore-safe key/name since the name is the HogQL table name), add warehouse-saved-queries to SMOKE_KINDS, and wire --warehouse-saved-query=<key> into smoke-cleanup.ts. Verified in isolation: seed -> apply -> pull --all-rows (hydrate + tag-back) -> dry-run no-op -> cleanup. (Full `pnpm smoke` remains blocked upstream by the pre-existing actions-pull gap on pl/spec-migration.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pl
added a commit
that referenced
this pull request
Jul 24, 2026
Logs sampling rules (#97), warehouse saved queries (#99), and batch exports (#100) complete the buildable surface. Logs alerts/metric rules, warehouse tables/view links deferred; group types excluded; notebooks parked. Adds a status section with the post-merge follow-up list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds warehouse saved queries (
projects/{id}/warehouse_saved_queries) as a managed resource — the first Wave 3 (data-warehouse) resource.Design
name(the unique HogQL table name) + identity/hash marker indescription(round-trips unbounded, PATCH-rewritable).tagsdropped by the serializer (live-verified). Model =name/query/description/folderId.querywrites with an edit token (queryPATCH without it → 400 "The query was modified by someone else"). The update executor refetches the row (also re-asserting the identity marker) and echoes the currentlatest_history_idasedited_history_id. Description-only writes (pull tag-back) skip the token.sync_frequencyis DAG-managed (direct PATCH → 400 "Schedule is managed by the DAG"), andrun/cancel/materializeare imperative — none are in the model.query, sohydrateForPullrefetches the full row before rendering.DELETE(204).Verification (dev project 806)
create → no-op re-apply → edit description → single update (exercises the
edited_history_idtoken path) → no-op → edit query → single update → no-op → orphan left untouched → hand-built row (no marker) invisible to plan/orphans (safety invariant) → scoped prune via directpruneWarehouseSavedQuery. Pull verified in isolation (seed → pull--all-rows→ hydrate + tag-back → dry-run "Nothing to do"). All rows cleaned up. Gates:typecheck/typecheck:examples/lint/test(302) all pass.Stacking
Stacks on #81 (
pl/spec-migration, codegen-only base). Retarget tomasterwhen #81 merges. First commit is the codegen regen (skippable in review).docs/resources.mdrow flipped;#78carries the full matrix refresh.🤖 Generated with Claude Code