Skip to content

Commit 2928766

Browse files
authored
docs: update semantic snowflake semantic views doc following CUB-2368 (cube-js#10810)
* upd * upd
1 parent 2baf0bc commit 2928766

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

docs-mintlify/docs/integrations/snowflake-semantic-views.mdx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ Alternatively, you can push Cube views into Snowflake as native semantic views.
4848

4949
This enables you to use Cube-authored views directly in Snowflake, maintaining consistency across both platforms.
5050

51+
### Cubes defined with `sql`
52+
53+
When a cube uses the `sql` property with a plain SQL string, Cube creates a helper
54+
Snowflake view named `CUBE_SV_SRC_<CUBENAME>` in a configurable schema (defaults to
55+
`PUBLIC`) and uses that view as the source for the semantic view. For example:
56+
`sql: "SELECT id, status FROM raw.orders"`.
57+
58+
Note that if you're simply referencing a table, use `sql_table` instead, as it's the
59+
recommended approach for straightforward table access (e.g., `sql_table: MY_SCHEMA.MY_TABLE`).
60+
5161
### Prerequisites
5262

5363
The push integration uses the SQL Runner to execute DDL statements in Snowflake. To
@@ -60,6 +70,8 @@ successfully create semantic views, ensure the following:
6070
- The Snowflake role configured for your Cube data source (via [`CUBEJS_DB_SNOWFLAKE_ROLE`](/reference/configuration/environment-variables#cubejs_db_snowflake_role))
6171
has privileges to create semantic views in the target database and schema
6272
(`CREATE SEMANTIC VIEW` on the schema, plus `USAGE` on the parent database and schema).
73+
If any cube uses a plain SQL string in its `sql` property, the role also needs
74+
`CREATE VIEW` privileges on the schema where helper views are created (which defaults to `PUBLIC`).
6375
- The role has `USAGE` on the warehouse specified by [`CUBEJS_DB_SNOWFLAKE_WAREHOUSE`](/reference/configuration/environment-variables#cubejs_db_snowflake_warehouse)
6476
and `SELECT` on the underlying tables referenced by the view.
6577
- [`CUBEJS_DB_SNOWFLAKE_QUOTED_IDENTIFIERS_IGNORE_CASE`](/reference/configuration/environment-variables#cubejs_db_snowflake_quoted_identifiers_ignore_case)
@@ -81,9 +93,10 @@ Cube only.
8193

8294
When pushing a Cube view to Snowflake, the following are currently not supported:
8395

84-
- **Cubes without a `sql_table`.** Each cube referenced by the view must be
85-
backed by a physical table. Cubes defined with an arbitrary `sql` block
86-
(subqueries, CTEs, or other inline SQL) can't be pushed.
96+
- **Cubes with templated `sql`.** If a cube's `sql` property uses template
97+
expressions (e.g., Jinja or dbt `{{ source(...) }}` syntax), it can't be
98+
pushed. See [Cubes defined with `sql`](#cubes-defined-with-sql) for details on
99+
what SQL patterns are supported.
87100
- **Cubes without a single-column primary key.** Every cube needs a
88101
`primary_key` dimension that resolves to a single physical column. Composite
89102
primary keys and primary keys defined as SQL expressions aren't supported.

0 commit comments

Comments
 (0)