Description
Model prefix (e.g., t.flights.carrier) works in .filter() lambdas but fails in with_dimensions() and with_measures() lambdas.
Reproduction
from boring_semantic_layer import from_yaml
models = from_yaml('examples/flights.yml')
flights = models['flights']
# ✅ WORKS - model prefix in filter
flights.filter(lambda t: t.flights.carrier == 'WN').group_by('flights.carrier').aggregate('flight_count').execute()
# ❌ FAILS - model prefix in with_dimensions
flights.with_dimensions(
x=lambda t: t.flights.carrier # ERROR: 'Table' has no attribute 'flights'
).group_by('x').aggregate('flight_count').execute()
# ❌ FAILS - model prefix in with_measures
flights.with_measures(
x=lambda t: t.flights.flight_count # ERROR: 'Table' has no attribute 'flights'
).aggregate('x').execute()
Expected Behavior
Behavior should be consistent - either model prefix works everywhere or nowhere.
Workaround
Use column names directly without model prefix in with_dimensions/with_measures:
flights.with_dimensions(x=lambda t: t.carrier).group_by('x').aggregate('flight_count')