ThoughtSpot acquires Mode to define the next generation of collaborative BI >>Learn More

Semantic layer integrations

⚠️ NOTE: Mode will be following dbt's lead in deprecating our integration to the first version of the semantic layer. Learn about our integration with dbt's Semantic Layer and please use the new connector.

Set up a data source connection

To get started, first set up a new data source connection to the semantic layer.

For the dbt Semantic Layer connection in Mode, you will need the following:

  • dbt Cloud Hostname: The hostname for the instance of dbt Cloud.
  • Environment ID: The unique identifier for a dbt environment in the dbt Cloud URL, when you navigate to that environment under Deployments.
  • Service Token: Service Tokens for dbt Cloud can be created in dbt account settings, and must have at least "Semantic Layer Only" permissions.

For the Looker SQL connection in Mode, leveraging Looker's Open SQL interface, you will need the following:

  • Host: The url of your Looker instance (e.g. test123.looker.com).
  • Username: The Client ID portion of the Looker API key.
  • Password: The Client Secret portion of the Looker API key.

Create a Semantic Layer Dataset

Once you’ve connected your semantic layer, create a Dataset to enable end user visual exploration. Navigate to the plus button in the top right, and select Make a reusable Dataset. You’ll be taken to a SQL editor interface.

Create a dbt Semantic Layer Dataset

Once you’ve pulled in your data, you can add additional fields via Calculated Fields or add descriptions for the existing fields. Check out Mode’s API endpoints for creating and updating field descriptions to programmatically add and update descriptions from your semantic layer documentation.

Write a dbt Metrics Query

To write a new dbt metrics query, select your dbt Semantic Layer connection from the database dropdown in the right panel. This connection will surface all available metrics to query. To reference a metric within your query, use the following syntax:

{% raw %}
select * from {{ 
	semantic_layer.metrics() 
}}
{% endraw %}

⚠️ NOTE: All queries need to be wrapped in {% raw %} {% endraw %} tags.

For more information on how to query the dbt Semantic Layer, see dbt’s documentation.

Write a Looker SQL Query

To write a new Looker SQL query leveraging Looker's Open SQL interface, select your Looker SQL connection from the database dropdown in the right panel. This connection will surface all available Models and Explores to query. To reference a field within your query, use the following syntax:

SELECT `view.field`
  FROM `model`.`explore`
  LIMIT 10;
SELECT `customers.state`, `customers.city`,
  AGGREGATE(`orders.total_amount`)
FROM `ecommerce`.`orders`
GROUP BY `customers.state`, `customers.city`
HAVING AGGREGATE(`orders.count`) > 10
ORDER BY 3 DESC LIMIT 5;

⚠️ NOTE: Use backticks around schema, table, and column identifiers. Wrap any LookML measures in the special function AGGREGATE() whether it is in a SELECT clause, a HAVING clause, or an ORDER BY clause. You cannot use LookML measures in a GROUP BY clause.

For more information on how to query using Looker's Open SQL interface, see Looker’s documentation.

Share Semantic Layer Datasets

To share Datasets created from the semantic layer, select the dropdown next to the Dataset name to rename the Dataset, set up a schedule and publish the Dataset to a Collection.

Share a dbt Semantic Layer Dataset

Select Rename to give the Dataset a name and description. Adding a name and description will ensure users can easily discover the Dataset and understand what data is included in the Dataset.

Select Schedule to add a new schedule. Adding a schedule ensures metrics data is updated for the Dataset on a regular cadence, so users building on top of the Dataset get the freshest data.

Select Move to… to move the Dataset into a Collection and make it discoverable to users. This will ensure users can find the Dataset when browsing or searching across Mode.

Was this article helpful?

Get more from your data

Your team can be up and running in 30 minutes or less.