[Wranglers] Snowflake now support querying from Semantic Views
Ali, Saqib
docbook.xml at gmail.com
Tue Jun 3 13:02:48 UTC 2025
Snowflake now supports querying from Semantic Views.
-- Let's create a Semantic View
CREATE OR REPLACE SEMANTIC VIEW tpch_analysis_semantic_view
TABLES (
customer AS SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER PRIMARY KEY
(c_custkey)
, orders AS SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.ORDERS
)
RELATIONSHIPS (
orders (o_custkey) REFERENCES customer
)
DIMENSIONS (
customer.customer_name AS c_name
, customer.customer_market_segment AS c_mktsegment
)
METRICS (
customer.customer_count AS COUNT(c_custkey)
, orders.order_count AS COUNT(o_orderkey)
, orders.order_average_value AS AVG(orders.o_totalprice)
, orders.order_total_value AS SUM(orders.o_totalprice)
, orders.first_order_date as min(orders.o_orderdate)
, orders.latest_order_date as max(orders.o_orderdate)
)
;
-- Now query the semantic view
SELECT * FROM SEMANTIC_VIEW(
tpch_analysis_semantic_view
DIMENSIONS customer.customer_market_segment
METRICS orders.order_count
, orders.order_average_value
, orders.order_total_value
, orders.first_order_date
, orders.latest_order_date
);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://analyticsengineering.net/pipermail/wranglers/attachments/20250603/9dd9adc3/attachment.htm>
More information about the Wranglers
mailing list