Core Platform

Working With Snowflake Semantic Views Directly in Tableau

We are excited to announce the public preview of the capability to export Snowflake Semantic Views as a Tableau Data Source (TDS) file. This new capability allows Tableau users to query Snowflake Semantic Views directly, enabling consistent consumption of the business logic, metrics and dimensions defined in Snowflake without semantic and data movement or duplication. Data teams can now deliver the same results in both of these analytics surfaces.

What is this feature?

This is a native capability that generates a Tableau data source (.tds) file from your Semantic View. You can trigger this export by clicking a button directly in the Snowsight UI or by using a simple system function.

Figure 1: To initiate the export, users simply select “Download TDS file” from the dropdown menu, conveniently located on the Semantic View page in the Snowsight UI.
Figure 1: To initiate the export, users simply select “Download TDS file” from the dropdown menu, conveniently located on the Semantic View page in the Snowsight UI.
SELECT SYSTEM$EXPORT_TDS_FROM_SEMANTIC_VIEW('sv_name_for_export');

Once downloaded, the TDS file acts as a translation layer, instantly configuring the following:

  • Connection details: Seamlessly points Tableau to the correct Semantic View.
  • Metadata mapping: Automatically interprets Snowflake metrics, facts and dimensions, mapping them to Tableau’s native measures and dimensions. By default, Snowflake Semantic View metrics are wrapped in the AGG() function in Tableau, enabling all metric calculation logic to be handled by the Semantic View compilation engine.
  • Folder structure: Preserves the organizational structure of your semantic model, enabling analysts to see a clean, curated list of fields ready for analysis.

After opening the file in Tableau Desktop or Tableau Online, users can easily gain insights by dragging and dropping measures and dimensions as they normally would.

How it works: A quick walkthrough

For this walkthrough, let’s assume we have a Semantic View named GROWTH_ANALYTICS_SV. This view is designed to answer common marketing attribution questions and joins marketing spend, user acquisition and product usage data. The Semantic View captures features such as:

  • Relationships: It connects signups (revenue and plan types), touchpoints (ad spend and campaigns) and user activity (session duration and features).
  • Dimensions: It standardizes key attributes for slicing and dicing, such as signup channel, plan type, region and cohort month.
  • Metrics: It contains precalculated, governed metrics such as RETURN_ON_AD_SPEND (ROAS), COST_PER_ACQUISITION (CPA) and CONVERSION_RATE.
  • Logic: It handles the complexity of aspects such as many-to-one relationships between marketing touchpoints and user signups automatically.

Step 1: Export the Tableau data source

To start analyzing this data in Tableau, we need to generate the connection file. If you are using the Snowsight UI, you can simply navigate to the Semantic View definition and click the "Download TDS file" button to download the file automatically.

screengrab for semantic view using tableau

You can also do this using the system function introduced as below:

SELECT SYSTEM$EXPORT_TDS_FROM_SEMANTIC_VIEW('SEMANTIC_VIEW_DEMO.GROWTH_ANALYTICS.GROWTH_ANALYTICS_SV');

Step 2: Import into Tableau

Once you have the .tds file (for example, GrowthAnalytics.tds), simply double-click it to launch Tableau Desktop. Once connected, you will notice that the left pane is preconfigured and you’ll see a clean, business-ready view of your data with components such as:

  • Attributes such as Signup Channel and Plan Type ready for slicing (aka dimensions)
  • Governed calculations such as Return on Ad Spend and Cost Per Acquisition (aka metrics)
  • Everything organized neatly into folders (such as signups, touchpoints and user activity)
visualization of folders

Tableau is now connected live to the Snowflake Semantic View, ensuring that every query generated by your dashboard is executed directly against the data in Snowflake. This helps ensure that you see the same results for both your AI and BI workloads.

Step 3: Analyze

You can now drag and drop fields to build visualizations. For instance, dragging Signup Channel to rows and metrics such as Total Ad Spend, Total Revenue and Return on Ad Spend in Columns onto the canvas will generate a query that is pushed down to Snowflake and lets you visualize the return on investment for different marketing channels.

The AGG difference

You will notice a key difference here compared to standard Tableau data sources. When you drag a metric from a Semantic View, Tableau automatically wraps it in an AGG() function for example, AGG(RETURN_ON_AD_SPEND)rather than the default SUM() or AVG(). The AGG function forces Tableau to push calculation computation to Snowflake, which helps honor the logic defined in the semantic layer and ensures that calculations are done at the correct grain.

viz of AGG difference

Note that you are also able to also request adhoc metrics (i.e. metrics that you haven’t defined in your semantic view). In the example above, clicks is a fact in Snowflake Semantic View and sum of total number of clicks is an adhoc metric requested.

If you check the query history in Snowflake, you will see Tableau querying the Semantic View directly:

SELECT "GROWTH_ANALYTICS_SV"."SIGNUP_CHANNEL" AS "SIGNUP_CHANNEL",
  SUM("GROWTH_ANALYTICS_SV"."CLICKS") AS "sum:CLICKS:ok",
  (AGG("GROWTH_ANALYTICS_SV"."RETURN_ON_AD_SPEND")) AS "usr:Calculation_516a7fe3d4b248a0a236:ok",
  (AGG("GROWTH_ANALYTICS_SV"."TOTAL_AD_SPEND")) AS "usr:Calculation_5bb8fbac9da4445c87ef:ok",
  (AGG("GROWTH_ANALYTICS_SV"."TOTAL_REVENUE")) AS "usr:Calculation_e0e8254369794625a8e1:ok"
FROM "SEMANTIC_VIEW_DEMO"."GROWTH_ANALYTICS"."GROWTH_ANALYTICS_SV" "GROWTH_ANALYTICS_SV"
GROUP BY 1

Tips and best practices for engineers

As you test this feature, here are a few technical details and best practices to keep in mind regarding Tableau’s interactions with Semantic Views:

  • Non-numeric metrics: Tableau expects measures to be numeric. If your Semantic View contains non-numeric metrics (for example, min_name), they will appear as dimensions in Tableau. To use them as measures, you will need to manually convert them to measures in Tableau.
  • Drag and drop order: The recommendation is to drag a dimension (such as signup channel) into the view before dragging in a measure. Dragging a measure alone may result in an error because Tableau attempts to run a generic COUNT(1) query, which can be dismissed.
  • You will be able to query your Snowflake Semantic Views in Tableau via live connection mode only. Extract mode isn’t supported.
  • Clicking on Measure Values in the data panel in Tableau isn’t supported and throws an error.
viz measure values
  • Clicking on <SEMANTIC_VIEW_NAME> (Count) in the data panel throws an error and isn’t relevant for the semantic view queries.
MY_TEST_SV
  • Changes made in the Tableau worksheets such as calculated fields added in your worksheet aren’t synced back to Snowflake Semantic Views.

Get started

This feature is now available in public preview. Learn more from our documentation, and we encourage you to try this integration!

Subscribe to our blog newsletter

Get the best, coolest and latest delivered to your inbox each week

Where Data Does More

  • 30-day free trial
  • No credit card required
  • Cancel anytime