Creating Business Context
A user in Finance or Marketing on a semantic layer does not want or may not be allowed access to everything. They want to see semantics relevant to them, with their context applied. That concept is called in Honeydew a “Domain”. A Domain is a lightweight governance object that allows to build context for users, as well as maintain access control on data and on metadata. That context includes:- Selection of entities and sub-selection of fields, that are accessible when using the domain
- Selection of filters that must be applied on every query on the domain
- Selection of parameter overrides that apply in the domain context
Selecting entities and fields
Domain allows to select entities that participate. For example, a domain that selects a subset of entities from TPCH:Selecting entity fields
By default, all fields from an entity are included in the domain. You can control which fields are included using field selectors - string patterns evaluated in the order they are listed. Field selector syntax:*- Include all fieldsfield_name- Include a specific field-field_name- Exclude a specific fieldpattern*,*pattern,*mid*- Include fields matching a wildcard pattern-pattern*,-*pattern,-*mid*- Exclude fields matching a wildcard pattern
- Selectors are evaluated in the order they are listed
- The last matching selector determines whether a field is included or excluded
- If no selectors are specified, all fields are included (equivalent to
["*"])
Filters
Domain may control how data is filtered. There are two types of filters: Semantic and Source.Semantic Filters
Filters within a domain apply to every query on the domain. Think of them as filters every user must add to every query. For example,sql field can contain ad-hoc expressions (as in the example above) or
reference named boolean attributes.
The display_name and description fields are optional.
Semantic Filters using Parameters
A common use case is filtering data based on a parameter that sets user context. For example, if:- Every user operates within a tenant context
- Data in Snowflake is partitioned by a tenant column (in the example below in a tenant dimension
dim_tenant, though can be a column in every table) - Users are only allowed to see data within their own tenant
$TENANT user parameter, and use it as a domain filter:
SET statements).
Source Filters
Source filters are filters that are applied at the source level (unlike semantic filters that apply to the semantic layer as a whole). The use cases for source filters are:- Improving performance with logically partitioned data by always pushing filters below calculated attributes.
- Removing duplicated data using conditional filtering, which is common when dealing with either Multi-Grain Data or Slowly Changing Dimensions with Multiple Versions
Source filters are only supported on attributes that come from an entity source table.
Conditional Filtering
In some case, a domain filter is desired unless the user filtered otherwise. The main use cases are:- Performance on large datasets - reduce the data by default unless the user has explicitly asked for more data.
- Correctness with Slowly Changing Dimensions.
- Correctness with Multi-Grain tables.
Domain Hierarchy
Domain hierarchy functionality is currently in Beta.
Contact support@honeydew.ai to activate it for your account.
Extending Domains
Use theextends field to inherit from parent domains:
What Gets Inherited
A child domain inherits from its parents:- All entities and their field selections
- All filters (semantic and source)
- All parameters
- All tags
- All labels (additive)
- All metadata sections
How Items Merge
Items in lists are matched byname. When a child defines
an item with the same name as a parent:
- Scalar fields (like
sqlin filters) are replaced - Collection fields (like
fieldsin entities) are extended - Use
merge: removeto remove an inherited item
Field Inheritance
When a child extends a parent entity, field operations apply on top of the inherited field list:fields: [*], the child already inherits
all fields. To restrict to specific fields, use -* first:
Filter Inheritance
Filters with the samename replace parent filters:
Label Inheritance
Labels use additive inheritance — child labels are added to parent labels:Tag Inheritance
Tags are matched bykey. Child tags with the same key
replace the parent tag; new keys are added:
Metadata Inheritance
Metadata sections are matched byname. Within each
section, items are matched by key:
Removing Inherited Items
Usemerge: remove to exclude items inherited
from parents:
Multiple Inheritance
Extend multiple parent domains for composition:Example: Regional Sales
sales_us domain includes:
- All three entities (customers without SSN)
- Both filters (
exclude_testinherited,us_regionadded) - Source filter for recent data
- US region parameter
- Snowflake metadata:
analyst_roleinherited,us_warehouseadded
Interfaces
Domains on SQL interface
Domains are present as a flat table in thedomains schema.
- Attributes that are part of the domain are accessible as SQL columns.
- Metrics that are part of the domain are accessible as SQL columns that can be aggregated on.
- All filters of the domain apply (in addition to any filters in the SQL query).
Domains as a context for dynamic datasets
A dynamic dataset can be associated with a domain. In that case, all domain configuration applies to the dynamic dataset query.Data Warehouse-specific domain configuration
Data warehouse access control
Domains can be configured to manage data warehouse session settings, such as assigning a specific role or linking a designated compute resource to each domain. This configuration is applied in the following scenarios:- Queries executed through the Honeydew SQL interface, such as those from a BI tool
- Queries executed via the Honeydew Native Application
- Queries run from the Honeydew web user interface
If a third-party tool uses Honeydew only to compile a SQL query and executes the query independently,
the domain’s data warehouse configuration will not apply to that query.
- Snowflake
- Databricks
- BigQuery
Configure the Snowflake role and warehouse in the domain’s
snowflake metadata section. Both fields are optional.Domain-level Snowflake role and warehouse configuration
does not apply to deployment actions of Dynamic Datasets
as views or tables in Snowflake. They are used only for data
queries executed on the domain or on dynamic datasets
associated with the domain.
Snowflake short-term aggregate caching
Domains can be configured to enable short-term aggregate caching in Snowflake. For more information, see Snowflake Short-Term Aggregate Caching.Tool-specific domain metadata
Domains can carry metadata sections read by specific tools and integrations:YAML Schema
Each domain is defined by a YAML file in Git, which also tracks and preserves the full history of every change. The schema for a domain is:name: Name of domainextends: Optional list of parent domains to inherit fromdisplay_name,owner,description,labels,folder,hidden: Metadatatags: List of key-value tags; matched bykeywhen inheriting — child tags replace parent tags with the same key; usemerge: removeto remove an inherited tagentities: List of entities that participate in the domainname: Name of entityfields: List of field selectors (if omitted, all fields are included)- Each selector is a string:
*,field_name,-field_name, or a wildcard pattern - Selectors are evaluated in the order listed; last match determines inclusion
- Each selector is a string:
alias: Optional alias for entitymerge: Optionalremoveto remove inherited entity
filters: List of semantic filtersname: Unique identifier for the filtersql: Filter expressiondisplay_name: Optional human-readable namedescription: Optional descriptionmerge: Optionalremoveto remove inherited filter
source_filters: List of source filtersname: Unique identifier for the filtersql: Filter expressiondisplay_name: Optional human-readable namedescription: Optional descriptionmerge: Optionalremoveto remove inherited source filter
parameters: List of parameters and values (override workspace or parent domain values)name: Parameter namevalue: Parameter valuemerge: Optionalremoveto remove inherited parameter
metadata: Additional metadata sections for the domainname: Section name (e.g., honeydew, snowflake)metadata: Key-value pairs within the section (see Tool-specific domain metadata for examples)