-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SL-1458] [Feature] Unable to traverse linkable dimensions beyond a certain level #945
Comments
Hey @gowthamgutha, thanks for opening an Issue. I'm gonna change this to a feature request since we're aware of this limitation. We currently only allow 2 hops, mainly because adding a third hop greatly increases the complexity of the join resolutions paths, and opens up a lot of ambiguous join paths. It's something we're aware of, and we've already started doing some work to better handle ambiguous join resolution. Take a look at this PR for an example: #914. The recommended path right now is to do some denormalization in dbt if you need metricflow to be able to join across more than 2 hops. |
Thanks for the update @Jstein77 . I've used de-normalized views to solve my use-case. m_address.sql {{ config(schema='Person') }}
select sp.Country, Person.Address.* from Person.Address left outer join {{ref('m_stateprovince')}} as sp on Person.Address.StateProvinceID = sp.StateProvinceID m_stateprovince.sql {{ config(schema='Person') }}
select Person.CountryRegion.Name as Country, Person.StateProvince.* from Person.StateProvince left outer join Person.CountryRegion on Person.StateProvince.COUNTRYREGIONCODE = Person.CountryRegion.COUNTRYREGIONCODE The above two models have been changed to facilitate the use-case sumlinetotal by billing country. The actual linkable dimension path ought to be Now, with the below semantic model changes for billtoaddress, we can make - name: billtoaddress
defaults:
agg_time_dimension: modified_date
description: |
sales order header
model: ref('m_address')
entities:
- name: bill_to_address_id
type: primary
expr: AddressID
- name: state_province_id
type: foreign
expr: StateProvinceID
dimensions:
- name: country
expr: Country
type: categorical
- name: city
expr: City
type: categorical
- name: modified_date
expr: ModifiedDate
type: time
type_params:
time_granularity: month |
Is this a new bug in metricflow?
Current Behavior
I have the following semantic model partially representing the
AdventureWorks
schema where the seed data is referenced from https://github.com/Data-Engineer-Camp/dbt-dimensional-modelling/tree/main/adventureworksAll the dbt models prefixed with
m_
are views which are simpleselect *
statements of their corresponding tables.Adapter used: Snowflake 1.7.1
DBT version: 1.7.4
For the metric,
sumlinetotal
created from the measuresalesorderdetail
, I am able to group by tillsales_order_id__bill_to_address_id__state_province_id
(upto 3 levels), but when I try to group bysales_order_id__bill_to_address_id__state_province_id__name
orsales_order_id__bill_to_address_id__state_province_id__country_region_id
it fails probably because of adding__name
and__country_region_id
and the error is:To validate the same, I have created another metric called
sumsubtotal
from thesalesorderheader
measure and I am able to traverse upto 3 levels, here again.bill_to_address_id__state_province_id__country_region_id
works but notbill_to_address_id__state_province_id__country_region_id__name
Expected Behavior
Should be able to traverse the link-able dimensions for more than 3 levels.
Steps To Reproduce
m_address
,m_countryregion
,m_salesorderdetail
,m_salesorderheader
,m_stateprovince
each containing simpleselect * from <table_name_without_m_>
Relevant log output
Traceback
Environment
Which database are you using?
snowflake
Additional Context
These are the constraints
SL-1458
The text was updated successfully, but these errors were encountered: