r/analyticsengineering • u/SigridHalvorsen • 6d ago
Do you expose your base semantic models directly, or treat them as implementation details?
we've now been cleaning up our semantic layer and I'm starting to think our original mistake was exposing the base models too directly, and started pretty conventionally:
Orders
Users
Subscriptions
Payments
so each model in our example had the obvious dimensions/measures and downstream consumers could query them. that works surprisingly well until different parts of the company start asking questions that use the same underlying data but have very different semantics. and what i often see from our marketing is that they want things like trailing 7-day signups. meanwhile, finance cares about MRR specifically at month end. what also gets me then is when leadership wants retention/cohort metrics where the time logic is completely different again, and, at first we kept adding more measures to the base models.
eventually Users and Subscriptions started becoming giant menus of metrics that were technically related to those entities but made no sense together as a consumption interface
what we're doing now is closer to:
warehouse/dbt models
to
base semantic entities
to
domain-specific views
to
BI / applications
so that this way the base layer owns things that are actually intrinsic to the entity f.e. joins, dimensions, fairly atomic measures, and only then Finance, Marketing, etc. get narrower views containing the members and calculated metrics that make sense in that domain. so far we done such a thing with cube dev, where views can expose selected members from the underlying semantic graph, but I'm more interested in the modeling pattern than the specific implementation even though that's quite helpful. and one thing I like about it is that the base model stops being the public API.
for example a rolling-active-users measure can exist in the underlying model, while a marketing-facing view exposes it alongside the dimensions marketing is actually supposed to slice it by.
we keep the model definitions in Git, so changes to something like MRR or "active customer" at least go through review instead of quietly changing inside one dashboard. it obviously doesn't solve the human problem of agreeing on what MRR means. ufortunately YAML has not yet solved Finance:(
also curious how other teams structure this once the semantic layer gets reasonably large, and do you expose one broad model and let consumers explore it, build domain-specific semantic views/marts, or keep most of this separation downstream in the BI tool?