
What is a Semantic Layer?
A semantic layer is a middleware between your data source and your data application. Cube is an API-first, four-part semantic layer that enables data engineers and developers to make their data consistent, secure, performant, and accessible across every application.
How does Cube’s Semantic Layer work?
Data Modeling
With an upstream semantic layer, create a centralized, single source of truth—with consistent metrics you only need to define once.
Cube uses Data Models to model raw data into meaningful business definitions and pre-aggregate data for optimal results.
More about Data Modeling
cubes:
- name: active_users
sql: SELECT user_id, timestamp FROM events
measures:
- name: weekly_active
sql: id
type: count_distinct
rolling_window:
trailing: 7 day
offset: start
dimensions:
- name: time
type: time
sql: timestamp
- name: active_users
sql: SELECT user_id, timestamp FROM events
measures:
- name: weekly_active
sql: id
type: count_distinct
rolling_window:
trailing: 7 day
offset: start
dimensions:
- name: time
type: time
sql: timestamp
cube(`active_users`, {
sql: `SELECT user_id, timestamp FROM events`,
measures: {
weekly_active: {
sql: `user_id`,
type: `count_distinct`,
rolling_window: {
trailing: `7 day`,
offset: `start`,
},
},
},
dimensions: {
time: {
sql: `timestamp`,
type: `time`,
},
},
});
sql: `SELECT user_id, timestamp FROM events`,
measures: {
weekly_active: {
sql: `user_id`,
type: `count_distinct`,
rolling_window: {
trailing: `7 day`,
offset: `start`,
},
},
},
dimensions: {
time: {
sql: `timestamp`,
type: `time`,
},
},
});
Data Access Control
Cube's semantic layer coordinates access control upstream of data applications—so that only the right people have access to the right metrics.
In Cube, authorization is based on the security context. Authentication tokens are generated based on your API secret.
More about Data Access Control
Caching
Cube’s caching layer ensures that every downstream app stays updated with the latest information—cost-effectively and with low latency.
Cube provides a two-level caching system: in-memory cache and configurable pre-aggregations.
More about Caching

Instant APIs
Integrate with data visualization tools and business intelligence dashboards, and bind to popular front-end frameworks to power custom interfaces.
Cube’s SQL, REST, and GraphQL APIs provide the universal compatibility data engineers and developers need.
More about APIs
SELECT
DATE_TRUNC('day', time) AS day,
MEASURE(weekly_active)
FROM active_users
WHERE time >= '2021-01-01' AND time < '2021-01-07'
GROUP BY day
DATE_TRUNC('day', time) AS day,
MEASURE(weekly_active)
FROM active_users
WHERE time >= '2021-01-01' AND time < '2021-01-07'
GROUP BY day
{
"measures": [
"active_users.weekly_active"
],
"timeDimensions": [
{
"dimension": "active_users.time",
"granularity": "day",
"dateRange": [
"2021-01-01",
"2021-01-07"
]
}
]
}
"measures": [
"active_users.weekly_active"
],
"timeDimensions": [
{
"dimension": "active_users.time",
"granularity": "day",
"dateRange": [
"2021-01-01",
"2021-01-07"
]
}
]
}
query CubeQuery {
cube {
active_users(
where: {
time: { inDateRange: ["2021-01-01", "
}
) {
weekly_active
time {
day
}
}
}
}
cube {
active_users(
where: {
time: { inDateRange: ["2021-01-01", "
2021-01-07
"] }}
) {
weekly_active
time {
day
}
}
}
}
What are the use cases of a Semantic Layer?
The use cases of a semantic layer span from unifying your organization’s knowledge base to wildly improving application performance, from cutting down app development time to creating beautiful, data-rich UX/UI—and then some.
Customer stories
With Cube, we’ve been able to speed up time to release a new data model to production by 5x and decrease analytics downtime by 90%.

Alessandro Lollo
Senior Data Engineer at Cloud Academy
Read the Story
Cube can do whatever your engineers want. They can build your analytics faster. There’s just not another tool out there that would fill in the blank for what we need.HTTP layer and abstraction over SQL.

Sebastian Okser
CTO at Cyndx
Read the Story
With Cube, we’ve reduced the time required to generate real-time and historical reports from 10’s of seconds to less than 2, while reducing our spending on hosting by almost 80%.

Brandon Ellis
Co-Founder & CTO at Cuboh
Read the Story
With Cube, we’ve been able to speed up time to release a new data model to production by 5x and decrease analytics downtime by 90%.

Alessandro Lollo
Senior Data Engineer at Cloud Academy
Read the Story
With Cube, we’ve been able to speed up time to release a new data model to production by 5x and decrease analytics downtime by 90%.

Alessandro Lollo
Senior Data Engineer at Cloud Academy
Read the Story
With Cube, we’ve been able to speed up time to release a new data model to production by 5x and decrease analytics downtime by 90%.

Alessandro Lollo
Senior Data Engineer at Cloud Academy
Read the Story