Saved Query Management
Saved query CRUD operations from creation through SQL and dataset updates to deletion.
Overview
This flow documents the saved query management operations for persisting and maintaining reusable queries. Saved queries enable analysts to build a library of useful analytical queries.
All saved query operations occur within the context of a Workspace container.
Each saved query belongs to exactly one workspace, and all query events include a workspaceId field enabling workspace-scoped subscriptions and filtering.
Query creation
Users save queries after successful execution to reuse them later. The SavedQueryCreated event captures the SQL, target dataset reference, and descriptive name.
Saved queries are associated with the creating user and may be shared.
Query modification
Saved queries can be modified over time as requirements evolve.
SQL updates allow refining the query logic without creating a new saved query. The SavedQuerySqlUpdated event maintains an audit trail of query evolution.
Dataset reference updates allow retargeting queries to different catalogs or tables. This is useful when migrating between development and production datasets.
Renaming allows improving query organization without affecting query logic.
Query deletion
Queries may be deleted when no longer needed. The SavedQueryDeleted event enables soft-delete patterns if audit requirements demand it.
Charts referencing deleted queries require attention (broken reference handling).
Query editor integration
The saved query system integrates with the query editor UI. Saved queries appear in a sidebar for quick loading.
The query editor state (current SQL, cursor position, results) is tracked separately from saved query state.
Version considerations
Saved queries do not currently version their SQL content. Each modification overwrites the previous version.
If versioning becomes necessary, the SavedQuerySqlUpdated events provide a full audit trail for reconstructing any historical version.