Skip to content

Verified queries implementation - #21

Open
joachimhodana wants to merge 1 commit into
Snowflake-Labs:mainfrom
joachimhodana:feature/verified-queries
Open

Verified queries implementation#21
joachimhodana wants to merge 1 commit into
Snowflake-Labs:mainfrom
joachimhodana:feature/verified-queries

Conversation

@joachimhodana

Copy link
Copy Markdown

Currently, the setup for verified queries is tricky and undocumented. This PR introduces an easier way to configure verified queries via a config macro, without breaking the existing with extension (CA = '{...}') workaround.

Example:

{{ config(
    materialized='semantic_view',
    verified_queries=[
      {
        "name": "Orders by day",
        "question": "How many orders did we have each day last month?",
        "sql": "select order_date, count(*) as orders from __orders group by order_date"
      },
      {
        "name": "Revenue by month",
        "question": "What is total revenue by month?",
        "sql": "select month, sum(revenue) as total_revenue from __orders_by_month group by month"
      }
    ]
) }}

TABLES(orders as {{ ref('orders') }})
DIMENSIONS(orders.order_date, orders.month)
METRICS(orders.total_revenue as sum(orders.revenue))

NOTE:
Unfortunately, I do not have access to a personal Snowflake account to test this PR. I would appreciate it if someone could test it and confirm whether it passes the test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant