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.
Last updated
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.
Last updated
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.
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.
Table and Column Information Configuration:
Navigate to "Table Info" tab
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
Click on "Column Info" tab
For each column:
Add relevant synonyms
Select appropriate data type
Include any column-specific notes or constraints
Synonyms in the Semantic Layer
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.
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.
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.
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.
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.