Skip to main content

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.
AI access to domains is managed through agents.
That context includes:
  1. Selection of entities and sub-selection of fields, that are accessible when using the domain
  2. Selection of filters that must be applied on every query on the domain
  3. 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 fields
  • field_name - Include a specific field
  • -field_name - Exclude a specific field
  • pattern*, *pattern, *mid* - Include fields matching a wildcard pattern
  • -pattern*, -*pattern, -*mid* - Exclude fields matching a wildcard pattern
Evaluation rules:
  • 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 ["*"])
Examples:
Field selectors are evaluated in order. For example, ["*", "-field_a", "field_a"] will include field_a because the last matching selector (field_a) is an inclusion.

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,
Semantic filter’s 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.
A semantic filter will be always added to a query in a domain context. That means that semantic filters may have a performance impact when they introduce more JOINs.For example, this SQL query on the domain above that asks for part count:
will include a JOIN to lineitems even though it was not directly referenced in the query to make sure only parts that where shipped over ground are included.

Semantic Filters using Parameters

A common use case is filtering data based on a parameter that sets user context. For example, if:
  1. Every user operates within a tenant context
  2. 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)
  3. Users are only allowed to see data within their own tenant
Set $TENANT user parameter, and use it as a domain filter:
Apply the parameter in the manner appropriate for the user queries (whether it is through BI connection settings or Snowflake SET statements).
If filtering data through a filtering dimension, make sure it is cross filtering the data with a one-to-many filtering direction.

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:
  1. Improving performance with logically partitioned data by always pushing filters below calculated attributes.
  2. 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.
A source filter is only applied if the source is part of the query.
Caution: Source filters apply before any other computation is done, which can change the values of calculated attributed. See filtering order for more details.When in doubt, use a semantic filter, not a source filter.

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.
See Conditional Filters for more details.
Conditional Filters are usually used to reduce data at the source, thus they are typically used within source filters.

Domain Hierarchy

Domain hierarchy functionality is currently in Beta. Contact support@honeydew.ai to activate it for your account.
Domains can extend one or more parent domains, inheriting and building upon their configuration. This enables reusable base domains that compose into specialized domains.

Extending Domains

Use the extends 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 by name. When a child defines an item with the same name as a parent:
  • Scalar fields (like sql in filters) are replaced
  • Collection fields (like fields in entities) are extended
  • Use merge: remove to remove an inherited item

Field Inheritance

When a child extends a parent entity, field operations apply on top of the inherited field list:
If the parent has fields: [*], the child already inherits all fields. To restrict to specific fields, use -* first:

Filter Inheritance

Filters with the same name replace parent filters:
This applies to both semantic and source filters.

Label Inheritance

Labels use additive inheritance — child labels are added to parent labels:

Tag Inheritance

Tags are matched by key. Child tags with the same key replace the parent tag; new keys are added:

Metadata Inheritance

Metadata sections are matched by name. Within each section, items are matched by key:

Removing Inherited Items

Use merge: remove to exclude items inherited from parents:
This works for entities, filters, source_filters, parameters, and tags.

Multiple Inheritance

Extend multiple parent domains for composition:
Parents are evaluated left-to-right. If multiple parents define the same item, the rightmost parent wins. The child overrides all parents.

Example: Regional Sales

The sales_us domain includes:
  • All three entities (customers without SSN)
  • Both filters (exclude_test inherited, us_region added)
  • Source filter for recent data
  • US region parameter
  • Snowflake metadata: analyst_role inherited, us_warehouse added

Interfaces

Domains on SQL interface

Domains are present as a flat table in the domains 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).
See SQL interface for more details.

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.
Domain-level configuration allows you to link user access (e.g., via a BI tool, SQL interface, or the Honeydew native application) to specific data and cost governance policies.This can also be used to enforce row-level security by scoping native data warehouse RLS policies to a domain-specific role.
This configuration is applied in the following scenarios:
  1. Queries executed through the Honeydew SQL interface, such as those from a BI tool
  2. Queries executed via the Honeydew Native Application
  3. 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.
Domain-level settings take precedence over the global data warehouse configuration. Domains without specific settings default to the global configuration for your Honeydew account.
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:
Fields:
  • name: Name of domain
  • extends: Optional list of parent domains to inherit from
  • display_name, owner, description, labels, folder, hidden: Metadata
  • tags: List of key-value tags; matched by key when inheriting — child tags replace parent tags with the same key; use merge: remove to remove an inherited tag
  • entities: List of entities that participate in the domain
    • name: Name of entity
    • fields: 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
    • alias: Optional alias for entity
    • merge: Optional remove to remove inherited entity
  • filters: List of semantic filters
    • name: Unique identifier for the filter
    • sql: Filter expression
    • display_name: Optional human-readable name
    • description: Optional description
    • merge: Optional remove to remove inherited filter
  • source_filters: List of source filters
    • name: Unique identifier for the filter
    • sql: Filter expression
    • display_name: Optional human-readable name
    • description: Optional description
    • merge: Optional remove to remove inherited source filter
  • parameters: List of parameters and values (override workspace or parent domain values)
    • name: Parameter name
    • value: Parameter value
    • merge: Optional remove to remove inherited parameter
  • metadata: Additional metadata sections for the domain