Documentation Index
Fetch the complete documentation index at: https://cubed3-docs-cub-2416-update-semantic-snowflake-semantic-vie.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Snowflake Semantic Views integration is available in Cube on the Enterprise plan.
Overview
The Snowflake Semantic Views integration provides two-way synchronization between Cube and Snowflake:- Pull integration: Pull semantic views from Snowflake and turn them into cubes and views in Cube
- Push integration: Push Cube views into Snowflake as native semantic views
Pull Integration
From the IDE, users can pull semantic views from Snowflake and turn them into cubes and views in Cube. The pull integration generates code files with cube and view definitions in your Cube repository, making it easy to work with existing Snowflake semantic views.How it works
- Connect to your Snowflake account from the Cube IDE
- Browse available semantic views in Snowflake
- Select the semantic views you want to import
- Cube generates the corresponding cube and view definitions
- The generated code files are added to your Cube repository
Push Integration
Alternatively, you can push Cube views into Snowflake as native semantic views. The push integration creates DDL from Cube’s definitions and executes it in Snowflake, creating Snowflake Semantic Views that match your Cube schema.How it works
- Select Cube views you want to push to Snowflake
- Cube generates DDL statements from your Cube view definitions
- The DDL is executed in your Snowflake account
- Native Snowflake Semantic Views are created matching your Cube schema
Cubes defined with sql
During a push, cubes that use the sql property instead of sql_table are
handled automatically:
- Plain SQL string (e.g.,
sql: "SELECT id, status FROM raw.orders"): Cube creates a helper Snowflake view namedCUBE_SV_SRC_<CUBENAME>in a configurable schema (defaults toPUBLIC) and uses that view as the source for the semantic view. - Simple table reference (e.g.,
sql: MY_SCHEMA.MY_TABLE): treated the same assql_table. - Templated SQL (e.g., Jinja or dbt expressions): not supported — the push will fail with a validation error.
Prerequisites
The push integration uses the SQL Runner to execute DDL statements in Snowflake. To successfully create semantic views, ensure the following:- Enable DDL operations for your Cube deployment. In the Cube Cloud UI, go to Deployment Settings → Configuration and turn on Enable DDL operations. Without this setting, the SQL Runner will reject the DDL statements that the push integration generates.
- The Snowflake role configured for your Cube data source (via
CUBEJS_DB_SNOWFLAKE_ROLE) has privileges to create semantic views in the target database and schema (CREATE SEMANTIC VIEWon the schema, plusUSAGEon the parent database and schema). If any cube uses a plain SQL string in itssqlproperty, the role also needsCREATE VIEWon the schema where helper views are created (defaults toPUBLIC). - The role has
USAGEon the warehouse specified byCUBEJS_DB_SNOWFLAKE_WAREHOUSEandSELECTon the underlying tables referenced by the view. CUBEJS_DB_SNOWFLAKE_QUOTED_IDENTIFIERS_IGNORE_CASEis set consistently with how identifiers are defined in your Cube data model. The default value isfalse.
Limitations
Cube’s data modeling layer is broader than what can be expressed natively in Snowflake Semantic Views today, so not every Cube view can be pushed as-is. Views that rely on the features below will continue to work in Cube, and the push wizard will flag them during validation so you can adjust them or keep them in Cube only. When pushing a Cube view to Snowflake, the following are currently not supported:- Cubes with templated
sql. If a cube’ssqlproperty uses template expressions (e.g., Jinja or dbt{{ source(...) }}syntax), it can’t be pushed. Cubes that usesql_tableor a plain SQL string are supported — see Cubes defined withsqlfor details. - Cubes without a single-column primary key. Every cube needs a
primary_keydimension that resolves to a single physical column. Composite primary keys and primary keys defined as SQL expressions aren’t supported. - Non-equi joins and expression-based joins. Joins must be simple equality
joins between columns. Function calls (e.g.,
LOWER({CUBE}.user_id) = {users.id}), inequality operators,ORconditions, and other expression-based join conditions can’t be translated. - Joins that don’t reference a primary key. The referenced side of every join must be the primary key of the target cube. Snowflake Semantic Views requires referenced columns to be a primary or unique key.
- Measure types beyond the basic aggregates. Snowflake Semantic Views
natively supports
count,count_distinct,sum,avg,min, andmax. Cube measures that combine other measures, apply per-measure filters, or use rolling windows don’t have a direct equivalent and can’t be pushed. - Advanced Cube features without a Snowflake equivalent. Segments, access policies, hierarchies, time-dimension granularities, view-level filters, and pre-aggregations are skipped during the push.
Benefits
The Snowflake Semantic Views integration provides several advantages:- Consistency: Keep your semantic layer definitions synchronized between Cube and Snowflake
- Flexibility: Work in your preferred environment—author in Cube or Snowflake
- Efficiency: Automatically generate definitions without manual conversion
- Collaboration: Enable teams to work in their preferred tools while maintaining consistency