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

Ref with package #68

Closed
AndreasTA-FF opened this issue May 31, 2021 · 10 comments
Closed

Ref with package #68

AndreasTA-FF opened this issue May 31, 2021 · 10 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@AndreasTA-FF
Copy link

Hi!

I've looked around but haven't found any issues about this.
Currently I can do {{ ref('some_table') }} and get autocomplete, but if I use the syntax {{ ref('some_package', 'some_table') }} it doesn't help me at all. Maybe I'm doing something wrong or it's not supported by the extension yet?
Everything is latest and greats.

Otherwise, great extension!

@mdesmet
Copy link
Contributor

mdesmet commented Jun 2, 2021

That is indeed currently not supported. Only the one parameter ref is supported. I have not yet have any use case for using ref with package name. Could you shine some light on your exact use case?

@AndreasTA-FF
Copy link
Author

Ofc, I will try to shine some light on it :)
We use multiple DBT projects and we use ref/sources between these. They way we do this is using packages.yaml and add other domains as dependencies. Doing it this way, we need to use ref('package','table') or source('pkg','table') to make sure we get the data from the correct project. Currently we use BigQuery so it might be different projects/datasets behind the scene.

Hope it makes some sense!

@mdesmet
Copy link
Contributor

mdesmet commented Jun 3, 2021

We also use extensively packags in our code. but never needed to use the package parameter. We simply ref('anotherModel') from another package. Why do you need to specify the package? Does this make it work if your model identifiers are duplicated?

@AndreasTA-FF
Copy link
Author

Well, it doesn't support duplicated model identifiers yet, but they are working on it and I really hope it will be possible soon 1269. Since we are spread out on multiple teams, we hope we don't have to care about clashes in the near future. Some reasons we would like to use the syntax ref('pkg','model') (same for sources)

  • prepared if it gets supported with duplicated model identifiers
  • It makes the code easier to read, to know from where this model is originating.

@robertoash
Copy link

We are also using the {{ ref('pkg', 'model') }} syntax for some of the same reasons already mentioned by others.

As well as the autocomplete, we are unable to navigate between the models using Cmd + click on the model name. That only works when using the {{ ref('model') }} syntax.

Both syntaxes are officially supported by DBT so it would be really nice if all features in the extension worked seamlessly regardless of which one has been chosen.

@mdesmet
Copy link
Contributor

mdesmet commented Oct 27, 2022

Sure, this change is definitely welcome! Are you willing to provide a PR for this feature?

@mdesmet mdesmet added enhancement New feature or request good first issue Good for newcomers labels Oct 27, 2022
@robertoash
Copy link

Sure, this change is definitely welcome! Are you willing to provide a PR for this feature?

I guess you are talking to me. More than willing but sadly unable. Just don't know enough to be able to contribute 😞

@mdesmet
Copy link
Contributor

mdesmet commented Nov 12, 2022

fixed for models in 0.8.8. Let me know if it works.

@mdesmet mdesmet changed the title Ref/Source with package Ref with package Nov 12, 2022
@mdesmet
Copy link
Contributor

mdesmet commented Nov 12, 2022

This doesn't seem to apply on sources. Please correct me if I'm wrong.

@mdesmet mdesmet closed this as completed Nov 14, 2022
@robertoash
Copy link

fixed for models in 0.8.8. Let me know if it works.

Thank you so much for this!

The Cmd + click navigation works perfectly. Autocomplete I believe is also working as expected.

We truly appreciate the helpful work you've put in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants