Schema

A Schema is a namespace within a workspace, used for logical grouping and permission isolation of data objects such as tables, views, and functions.

Analogy to relational databases: a workspace is equivalent to a database instance, and a schema is equivalent to a database. Multiple schemas can be created within a single workspace, for example, divided by business domain as ods, dwd, ads.

Key Purposes of Schema

PurposeDescription
Logical groupingGroup related tables and views by business domain or data layer
Name isolationObjects with the same name can exist in different schemas without conflicts
Permission controlGrant access permissions at the schema level as a whole
Default contextSet the current schema with USE SCHEMA to simplify SQL writing

Hierarchy

Workspace ├── Schema A (e.g., ods) │ ├── Tables │ └── Views └── Schema B (e.g., ads) └── Tables

Common Operations

-- Create a schema CREATE SCHEMA ods; -- Switch the current schema USE SCHEMA ods; -- Reference objects across schemas SELECT * FROM ads.dim_user;