Semantic Layer

This guide provides a comprehensive step-by-step process for building and managing a semantic layer in DataBrain's Data Studio, making it essential for data professionals.

What is a Semantic Layer?

A semantic layer is a business representation of data and offers a unified and consolidated view of data across an organization.

Purpose of Semantic Layer

A semantic layer provides a user-friendly interface that translates complex data structures into understandable business terms, enabling non-technical users to easily access, analyze, and generate insights from data without needing deep technical expertise.

Key Feature of DataBrain's Semantic Layer:

Example: Users can search for "Customer Name" instead of using technical identifiers like "customer_id." Context: It simplifies data access for everyone, making it easier to interpret and analyze.

  1. Initial Access:

  • In the "Data Studio" page of DataBrain, navigate to the "Semantic Layer" section.

  • Click on datamart name for which you want to create the semantic layer.

  1. Table and Column Information Configuration:

Table Info Tab

  1. Navigate to "Table Info" tab

  2. Fill out the following:

    • Table Description: Provide comprehensive details about the table's purpose and contents

    • Table Synonyms: Add alternative names for the table

    • Miscellaneous Info: Include any additional relevant information or constraints

Column Info Tab

  1. Click on "Column Info" tab

  2. For each column:

    • Add relevant synonyms

    • Select appropriate data type

    • Include any column-specific notes or constraints

Synonyms in the Semantic Layer

  1. Table Synonyms

    Example: If your datamart has a table named "Customer Data," appropriate synonyms might include "Client Information," "Customer Records," or "User Profiles."

    Context: Synonyms help users find the table using different terminologies they may be familiar with, improving accessibility and usability.

  2. Column Synonyms

    Example: For a column labeled "Order Date," synonyms could be "Purchase Date," "Transaction Date," or "Sale Date."

    Context: By providing synonyms for columns, users can query data more intuitively, using terms that resonate with their understanding of the dataset.

  1. Define Relationships:

  • Navigate to "Define Relationships" tab and describe the relationships between the columns and cardinality between the tables.

  • Then, specify any other relevant information or important constraints.

Functionality: Users can define relationships between tables, including cardinality (one-to-one, one-to-many), directly within the semantic layer.

Context: This capability ensures that the data model accurately reflects real-world relationships, which is crucial for accurate reporting and analysis. By clearly defining how different datasets relate to each other, users can perform more meaningful analyses.

Example: In a sales database, a one-to-many relationship can be established between a "Customers" table and an "Orders" table, allowing analysts to easily understand that each customer can place multiple orders.

  1. Definitions

  • Access "Definitions" tab

  • Create analytical questions:

    • Click "+ Definitions" to add new questions

    • Use search functionality to find existing definitions

  • Create a definition by clicking on "+ Definitions" icon and then export the definitions using "Export" button.

Functionality: Users can create analytical questions and definitions that are easily searchable within the semantic layer.

Context: This feature streamlines the process of generating insights by allowing users to formulate queries based on predefined definitions rather than starting from scratch each time. It fosters consistency in reporting across the organization.

Example: An analyst might define a metric called "Total Revenue," which aggregates sales from various sources. Other users can then search for this definition when creating their reports, ensuring everyone uses the same calculation method.

  1. Actions on semantic layer:

After creating the semantic layer, you can perform 3 actions:

  • Lab

  • Playground

  • Sample Set

Lab

  • Synthetic Query - Generate and test queries, and validate query outcomes

  • Logs - Review chat mode questions and track query history

  • Evals -Add evaluation criteria and monitor performance

Playground

Access the search bar to test LLM responses and view the results.

Sample Set

Create sample datasets for the created datamart.

Functionality: The Lab feature provides an environment where users can generate synthetic queries and validate their results against expected outcomes.

Context: This integrated testing capability allows analysts to experiment with different queries safely without affecting live data or reports. It also helps ensure that the semantic layer functions correctly before deploying it for broader use.

Example: An analyst can create a synthetic query to calculate total sales for the last quarter and verify that the results match their expectations before using it in a dashboard or report.

Last updated