Removes a semantic context and its curated content (pinned tables, expressions, example queries, sample questions); catalog-level virtual constraints are intentionally left in place.
DROP SEMANTIC CONTEXT [IF EXISTS] <name>
## Overview DROP SEMANTIC CONTEXT removes a semantic context by name. Deleting the context cascades to the content owned by that context: its pinned tables, its named expressions, its trusted example queries, and its sample questions are all removed with it. The context is addressed by its machine name, matched case-insensitively, and resolved to the stored id by the control plane before deletion. Only the control plane writes the underlying store, so the command is served through the control plane API. ## Behavior - Without IF EXISTS, dropping a context whose name does not resolve raises a clear not-found error. With IF EXISTS, the statement is a no-op success when the context is absent. - Deleting a context cascades to its pinned tables, expressions, example queries, and sample questions. These belong to the context and are removed with it. - Catalog-level virtual key constraints (declared by ALTER SEMANTIC CONTEXT ADD PRIMARY KEY / FOREIGN KEY / UNIQUE) are intentionally NOT deleted. They are stored per table rather than per context and may back other contexts; remove them explicitly with ALTER SEMANTIC CONTEXT ... DROP CONSTRAINT when they are no longer wanted. - Dropping a context removes only grounding metadata. No physical table, view, or table data is touched; the pinned tables continue to exist unchanged. - The result is a single-row status batch confirming the drop (or the no-op when IF EXISTS matched nothing). ## Access Control Managing a semantic context is a metastore-level curation operation served by the control plane. Dropping a context removes only grounding metadata and grants or revokes no data access. The tables it pinned remain governed by their existing table-level privileges. ## Compatibility DROP SEMANTIC CONTEXT is a DeltaForge extension. There is no ANSI SQL equivalent.
| Name | Type | Description |
|---|---|---|
name | Specifies the machine name (slug) of the semantic context to remove. Matched case-insensitively. The control plane resolves the name to the stored id and deletes that context. | |
IF EXISTS | Suppresses the error that is otherwise raised when no context with the given name exists. When present and the context is absent, the statement is a no-op success. |
-- Remove a context by name
DROP SEMANTIC CONTEXT sales;
-- Idempotent removal: no error if the context is already gone
DROP SEMANTIC CONTEXT IF EXISTS sales;