Skip to content
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

Problem reported on issue #282 still happens after fix #286

Closed
jefersonmsantos opened this issue Oct 14, 2024 · 1 comment
Closed

Problem reported on issue #282 still happens after fix #286

jefersonmsantos opened this issue Oct 14, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@jefersonmsantos
Copy link

After this fix, issue reported here is still happening.

I understand it happens because on the environment described on previous issue, the alias for model finance__subscriptions is subscriptions and the name for source('stripe','subscriptions') is also subscriptions.

On file _exposures, on line 79 it will search for alias and then fallback to name.

models = self.manifest.read_models()

        ctx = self.__Context(
            model_refs={m.alias.lower(): m.ref for m in models if m.ref},
            table_names={t["id"]: t["name"] for t in self.metabase.get_tables()},
        )

In this situation we have two elements with same key subscriptions. I believe it returns the last processed model on model_refs and updates the key with its last value. So, on ctx.model_refs we have something like:

'subscriptions': 'source("backend", "subscriptions")',
'stg__subscriptions': 'source("backend", "subscriptions")'

There are two entries (due to 2 with same subscriptions key) instead of three for the three existent models.

Actual Behavior

When run dbt-metabase exposures, exposures.yml generated has content, with depends_on = source('stripe', 'subscriptions'):

version: 2
exposures:
  - name: finance_subscriptions
    label: Finance Subscriptions
    description: '### Visualization: Table


      No description provided in Metabase


      #### Metadata


      Metabase ID: __1__


      Created On: __2024-10-11T17:21:00.719718Z__'
    type: analysis
    url: http://localhost:9090/card/1
    maturity: medium
    depends_on:
      - source('stripe', 'subscriptions')

Expected Behavior

We expect the dependency for Finance Subscriptions dashboard to be ref('stg_stripe__subscriptions'):

version: 2
exposures:
  - name: finance_subscriptions
    label: Finance Subscriptions
    description: '### Visualization: Table


      No description provided in Metabase


      #### Metadata


      Metabase ID: __1__


      Created On: __2024-10-11T17:21:00.719718Z__'
    type: analysis
    url: http://localhost:9090/card/1
    maturity: medium
    depends_on:
      - ref('stg_stripe__subscriptions')

P.S. I had tried this change on parsing by alias before without success.

@gouline
Copy link
Owner

gouline commented Oct 14, 2024

Please don't create duplicate issues, if #282 isn't resolved, keep the conversation there and I'll reopen if necessary.

@gouline gouline closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2024
@gouline gouline added the duplicate This issue or pull request already exists label Oct 14, 2024
@gouline gouline changed the title Problem reported on issue 232 still happens after fix Problem reported on issue #282 still happens after fix Oct 14, 2024
@gouline gouline changed the title Problem reported on issue #282 still happens after fix Problem reported on issue #283 still happens after fix Oct 14, 2024
@gouline gouline changed the title Problem reported on issue #283 still happens after fix Problem reported on issue #282 still happens after fix Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants