DROP SEMANTIC VIEW

更新时间:
复制 MD 格式

Deletes a specified semantic view. After deletion, the view's definition is unrecoverable and all semantic queries that depend on it will fail.

Note

All semantic view DDL statements require the optimizer hint /*+ enable_semantic=true */ at the beginning of the statement. Without this hint, the system cannot recognize semantic view syntax.

Syntax

/*+ enable_semantic=true */
DROP SEMANTIC VIEW [ IF EXISTS ] [view_schema.]view_name

Parameters

Parameter

Required

Description

IF EXISTS

No

Suppresses the error when the specified semantic view does not exist. A warning is produced instead. If not specified, an error is returned when the target view does not exist.

view_schema

No

The database that contains the semantic view. If omitted, the current database is used.

view_name

Yes

The name of the semantic view to delete.

Usage notes

  • Dropping a semantic view permanently removes all of its metadata, including logical tables, dimensions, metrics, facts, and relationships. This action is irreversible.

  • The underlying physical tables and their data are not affected. Only the semantic view definition is removed.

  • Dropping a semantic view synchronously clears the associated vector index. If the Embedding service is unavailable at the time of execution, the operation may fail. You can safely retry the statement because the DDL is atomic and idempotent.

  • After a semantic view is dropped, all semantic queries that reference it will return errors.

  • You cannot drop multiple semantic views in a single statement. Execute a separate DROP SEMANTIC VIEW statement for each view.

Examples

  • Drop a semantic view from the current database.

    /*+ enable_semantic=true */
    DROP SEMANTIC VIEW sales_view;
  • Drop a semantic view with a schema qualifier.

    /*+ enable_semantic=true */
    DROP SEMANTIC VIEW analytics_db.quarterly_report;
  • Use IF EXISTS to safely drop a semantic view that might not exist.

    /*+ enable_semantic=true */
    DROP SEMANTIC VIEW IF EXISTS old_metrics;