Synonym
A Synonym creates an alias for a data object in the Lakehouse, allowing the same object to be accessed by different names without copying any data. Synonyms belong to a schema, and names must be unique within the same schema.
Synonyms can be created for the following object types: table, table stream, dynamic table, materialized view, volume, and function.
Typical Use Cases
| Scenario | Description |
|---|---|
| Simplify cross-schema references | Create a synonym in schema02 for a table in schema01 — no need to write the full path in queries, and data stays in sync in real time |
| Maintain compatibility with old names | After renaming a table, create a synonym for the old name so existing SQL does not need to be updated |
| Abstraction layer isolation | Protects client applications from changes to the names or locations of underlying objects |
Create Syntax
Object type keywords:
TABLE(default): Used for table, table stream, dynamic table, and materialized view. The keyword can be omitted.VOLUME: Must be specified when creating a synonym for a volume; otherwise the system defaults to looking for a table object with that name.FUNCTION: Must be specified when creating a synonym for a function; otherwise the system defaults to looking for a table object with that name.
Drop Syntax
Permission Management
Query permissions on a synonym are the same as permissions on the base object: granting permissions on a synonym is equivalent to granting permissions on the base object, and vice versa.
Usage Examples
Creating a Synonym for a Table
Creating a Synonym for a Table Stream
Creating a Synonym for a Dynamic Table
Creating a Synonym for a Materialized View
Creating a Synonym for a Volume (VOLUME keyword required)
Creating a Synonym for a Function (FUNCTION keyword required)
Viewing Synonyms
Related Documentation
- CREATE SYNONYM — Complete syntax
- DROP SYNONYM — Drop syntax
- SHOW SYNONYMS — Listing synonyms
