[Wranglers] Snowflake now support querying from Semantic Views
Ali, Saqib
docbook.xml at gmail.com
Mon Jun 16 04:01:49 UTC 2025
Here is a blogpost how Semantic Views ensures the aggregations are being
calculated at the correct grain:
https://forum.edu.scot/t/semantic-views-and-grain-of-the-data/35
Thanks,
Saqib
On Wed, Jun 11, 2025 at 10:02 AM Ali, Saqib <docbook.xml at gmail.com> wrote:
> Another detailed blogpost on Semantic Views by Chanin Nantasenamat:
>
> https://medium.com/snowflake/getting-started-with-snowflake-semantic-view-7eced29abe6f
>
> On Wed, Jun 11, 2025 at 5:34 AM Ali, Saqib <docbook.xml at gmail.com> wrote:
>
>> Here is a blogpost on using Semantic Views for Aggregate-sensitive
>> Metrics:
>>
>> https://forum.edu.scot/t/using-semantic-views-for-aggregate-sensitive-metrics/34
>>
>>
>>
>> On Wed, Jun 4, 2025 at 7:23 AM Ali, Saqib <docbook.xml at gmail.com> wrote:
>>
>>> Snowflake Quick Start guide for Semantic Views:
>>>
>>> https://quickstarts.snowflake.com/guide/snowflake-semantic-view/index.html#0
>>>
>>> On Tue, Jun 3, 2025 at 11:58 AM Ali, Saqib <docbook.xml at gmail.com>
>>> wrote:
>>>
>>>> here is the Snowflake official documentation on Semantic Views:
>>>> https://snowflake.com/en/engineering-blog/native-semantic-views-ai-bi/
>>>>
>>>>
>>>>
>>>> On Tue, Jun 3, 2025 at 9:50 AM Ali, Saqib <docbook.xml at gmail.com>
>>>> wrote:
>>>>
>>>>> One thing I noticed is that while Snowflake lets you define PRIMARY
>>>>> KEY on the TABLE in a Semantic View, it does not enforce the Primary Key
>>>>> constraint. This could potentially lead to incorrect metric calculations in
>>>>> the Semantic View. Hopefully Snowflake fixes this soon......
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Jun 3, 2025 at 6:02 AM Ali, Saqib <docbook.xml at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> 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/20250615/2fd5a013/attachment.htm>
More information about the Wranglers
mailing list