Combine #206 and #207: YAML calculated_measures + model-prefix fixes#211
Open
Combine #206 and #207: YAML calculated_measures + model-prefix fixes#211
Conversation
Add `calculated_measures` section to YAML schema for derived metrics that reference other measures by name. Expressions are evaluated at runtime against MeasureScope, which also enables `.all()` for percent-of-total window aggregation patterns. Closes #202, closes #115 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add prefix-aware column navigation to ColumnScope and MeasureScope so that dimension/measure lambdas can use model prefixes (e.g., `t.flights.carrier`) after joins. Previously this only worked in `.filter()`. Also adds _DimensionTableProxy for dimension evaluation with merged dimension map awareness. Closes #136 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lent fallback Proxy classes (_ColumnPrefixProxy, _DimPrefixProxy) now raise AttributeError when a prefixed name isn't found, preventing silent resolution to unrelated unprefixed columns. Also preserves AttributeError from proxy evaluation in Dimension.__call__ for proper dependency resolution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR combines the changes from:
calculated_measuresand.all()in YAMLwith_dimensions/with_measuresafter joinsWhat I did:
mainin one branchsrc/boring_semantic_layer/tests/test_yaml.pyby keeping all relevant test sections (Self-joins not yet supported wiht YAML #114, Inconsistent model prefix behavior in lambdas: works in filter() but fails in with_dimensions/with_measures #136, Support calculated measures (derived metrics) in YAML #202, .all() for window aggregations not supported in YAML #115)Notes: