gouline / dbt-metabase

dbt + Metabase integration
https://pypi.org/project/dbt-metabase/
MIT License
441 stars 63 forks source link

Handle uppercase references from Metabase GUI derived queries #242

Closed alex-float-on closed 3 months ago

alex-float-on commented 3 months ago

Relates to discussion: https://github.com/gouline/dbt-metabase/discussions/241

Some data warehouses, such as snowflake, store their object names (database, schema, table, columns) in uppercase (ref).

This means that metabase questions derived from the visual editor (GUI) need to have their sources lowercased in order to match with dbt's models and nodes. We already do this for SQL native queries (refs: 1, 2) so this is just a continuation of that logic.

Update

If table.json fixture is modified to contain uppercase table names, the exposure tests fail before this change is applied and pass after it is applied.

alex-float-on commented 3 months ago

Thanks for your guidance @gouline.

I modified the table.json fixture to demonstrate how the fix addresses the snowflake uppercase issue.

One thing I noticed, however, is that we don't actively test table join exposures coming from non-sql questions. The only metabase question with a join is card 23 but this card also happens to be the only one that is missing from the expected exposures.

I wasn't sure how to add this exposure fixture back in but I believe it could/should be handled in a followup PR, since it was missing before my PR. I'd be happy to make the change if you give me a nudge in the right direction 🙂

gouline commented 3 months ago

One thing I noticed, however, is that we don't actively test table join exposures coming from non-sql questions. The only metabase question with a join is card 23 but this card also happens to be the only one that is missing from the expected exposures.

I fixed this in #244.