See the cube reference for the full list of
parameters and configuration options.
Defining a cube
A cube points to a table in your data source usingsql_table:
sql property for more complex queries:
Cube members
Each cube contains definitions for its members: dimensions, measures, and segments.Dimensions
Dimensions represent the properties of a single data point โ the attributes you group by and filter on, such asstatus,
city, or created_at:
Measures
Measures represent aggregated values over a set of data points โ counts, sums, averages, and custom calculations:Segments
Segments are predefined filters on a cube. They allow you to define commonly used filter logic once and reuse it across queries:Joins
Joins define relationships between cubes, forming the data graph that Cube uses to generate multi-table SQL queries:one_to_one, many_to_one, and one_to_many relationship
types. See working with joins for advanced
patterns like cross-database joins and join direction control.
Pre-aggregations
Pre-aggregations are materialized summaries of cube data that dramatically speed up query execution. Cube automatically matches incoming queries to the best available pre-aggregation:Designing effective cubes
One cube per entity
Map each cube to a single business entity โorders, users,
products, line_items. Use joins to connect them rather than
creating wide cubes with data from multiple tables.
Keep naming consistent
Use clear, consistent naming for members. Dimensions should describe attributes (status, city, created_at), and measures should describe
aggregations (count, total_revenue, average_order_value). Add
description and title for
user-friendly display.
Control visibility
Usepublic to hide cubes that should not be
directly queried by end-users. In most data models, cubes are internal
building blocks and views are the public interface:
Scale with extension and polymorphism
When cubes share common members, useextends to
avoid duplication. For data models with many similar entities,
polymorphic cubes let you define a base cube
and specialize it per entity.
Next steps
- See the cube reference for the full list of parameters
- Learn about views to expose cubes to end-users
- Explore calculated measures for derived metrics
- Use the Semantic Model IDE to develop cubes interactively