Overview
Globals allow you to define reusable objects (entities, dimensions, measures, descriptions, and more) in a centralized location and reference them across multiple specifications. This reduces duplication, ensures consistency, and makes maintenance easier.Key Benefits
- Single Source of Truth: Define common objects once in the
globals/directory - Inheritance Support: Use
inherits_fromto extend global definitions - Template Variables: Reference global values in semantic views and workflows
- On-Demand Loading: Files are loaded only when needed with intelligent caching
- Reduced Duplication: Avoid repeating the same dimension/entity/measure definitions
Project Structure
Place your globals file in theglobals/ directory at your project root:
Defining Globals
Create aglobals/semantics.yml file with reusable objects:
globals/semantics.yml
Using Globals
Inheritance in Semantic Views
Useinherits_from to inherit properties from global definitions:
semantics/views/orders.view.yml
Inheritance in semantics.yml
Thesemantics.yml file supports inheritance to avoid repeating dimension properties across multiple target mappings:
semantics.yml
Template Variables
Reference global values using template syntax:semantics/views/users.view.yml
Workflow Variables
Pass global values to workflow tasks:workflows/sales-report.workflow.yml
Reference Syntax
Global references use dot-notation:globals.<file>.<path>
- File:
semantics(name of the file in globals/ without .yml extension) - Path: Dot-separated path to the object within the file
name property. For semantic objects like entities, dimensions, and measures that are defined as objects/maps, use the key: <type>.<key>. For simple key-value pairs like descriptions and tables, the path is just <section>.<key>.
Examples:
globals.semantics.entities.customer- Entity with key “customer”globals.semantics.dimensions.customer_id- Dimension with key “customer_id”globals.semantics.measures.total_sales- Measure with key “total_sales”globals.semantics.descriptions.shipping_address- Description valueglobals.semantics.tables.users- Table name value
Property Merging
When usinginherits_from, child properties override parent properties: