Manage Semantic View
DROP SEMANTIC VIEW
Deletes the specified semantic view.
Syntax:
IF EXISTS prevents errors when the view does not exist. It is recommended to always include it in scripts.
Example:
ALTER SEMANTIC VIEW
ALTER SEMANTIC VIEW supports three types of operations: RENAME TO for renaming, SET PROPERTIES for setting properties, and UNSET PROPERTIES for removing properties. It still does not support dynamically adding/removing dimensions, metrics, or modifying comments via SQL, and does not support CREATE OR REPLACE SEMANTIC VIEW (which returns only view/stream/materialized view support replace). To modify dimension / metric / logical table structure, you must DROP and rebuild.
RENAME TO
Syntax:
The new name must not include a schema prefix; after renaming, the view remains in the original schema.
Example:
SET / UNSET PROPERTIES
Set or remove custom key-value properties on a Semantic View. Properties can be read back via the properties row in DESC EXTENDED output and are commonly used to store metadata or authoritative definitions alongside the view object itself.
Syntax:
SET PROPERTIES uses merge (upsert) semantics — it updates only the specified keys and does not affect other existing keys. To remove a key, use UNSET PROPERTIES. CREATE SEMANTIC VIEW does not support a PROPERTIES clause; properties can only be set after creation via ALTER ... SET PROPERTIES.
Examples:
SHOW SEMANTIC VIEWS
Lists all semantic views under the specified schema, returning two columns: schema_name and table_name.
Syntax:
It is recommended to always include IN <schema_name>. Without it, views under the current default schema are returned.
Example:
You can also query via information_schema.tables to get additional metadata:
DESC EXTENDED
View the complete definition of a semantic view, including logical table structures, primary/foreign key relationships, dimension metadata, and metric definitions.
Note: DESC <view_name> (without EXTENDED) returns an empty result set. You must include EXTENDED.
Syntax:
Example:
Returned content includes:
- Basic view information: workspace, schema, creator, created_time, last_modified_time, comment
- Logical table list: alias, full physical table name, primary key, foreign key
- Dimension list: name, expression,
isUnique,isTime,enumValues, comment - Metric list: name, aggregation expression, comment
Access Control
Semantic views support standard GRANT/REVOKE permission management, but only read-only permissions (SELECT, ALL) are supported. INSERT, UPDATE, and DELETE are not supported.
GRANT
REVOKE
SHOW GRANTS
View the permission grants on a semantic view:
Returned columns: granted_type, privilege, granted_on (value is SEMANTIC_VIEW), object_name, granted_to, grantee_name, grantor_name, grant_option, granted_time.
Command Quick Reference
| Command | Description |
|---|---|
DROP SEMANTIC VIEW IF EXISTS | Delete a semantic view |
ALTER SEMANTIC VIEW ... RENAME TO | Rename |
ALTER SEMANTIC VIEW ... SET PROPERTIES | Set properties (merge semantics) |
ALTER SEMANTIC VIEW ... UNSET PROPERTIES | Remove properties |
SHOW SEMANTIC VIEWS [ IN schema ] | List semantic views |
DESC EXTENDED | View full structure (must include EXTENDED) |
GRANT SELECT ON SEMANTIC VIEW | Grant query permission |
REVOKE SELECT ON SEMANTIC VIEW | Revoke query permission |
SHOW GRANTS ON SEMANTIC VIEW | View permissions |
