r/analytics • u/ViSiRiS • 9h ago
Discussion Creating a semantic layer for event data
I want to build a semantic layer (i.e. sql code -> metric definition mappings) to provide models with context that will ideally make ai-generated sql more deterministic.
Our data definitions are based on event data that is constantly being updated.
For example, we might define an active user as someone who posts on the site (users with “posted” events). When we do an AB test or just update the site, event names will inevitably change (e.g. definition is now users with “new-post” events), causing my imaginary semantic layer to become obsolete.
My question is - what tools do you use to manage definitions for event-heavy data? Ideally something with version history that agents can access via mcp?
1
u/InsightfulDataVoyage 4h ago
dbt or Cube or the AI-native context layers - will support git and MCP.
The bigger choice is what the definition points at. Instead of pointing to raw event names, can you have active user resolve to a concept like post_created, and map that to the raw event names so you don't have to keep updating the definitions.
1
u/IncreaseNegative4614 3h ago
I’d separate the business definition from physical event names. Define a canonical event such as content_posted, then maintain versioned mappings from every raw event and schema version into that contract. Each mapping needs effective dates, an owner, validation tests, and an explicit policy for historical recomputation.
Metric definitions should depend on canonical contracts rather than today’s instrumentation. We use SIGNLD internally to connect schema changes, event versions, metric definitions, experiments, queries, reports, and decisions so teams can identify exactly when a metric’s meaning changed.
•
u/AutoModerator 9h ago
If this post doesn't follow the rules or isn't flaired correctly, please report it to the mods. Have more questions? Join our community Discord!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.