-
Notifications
You must be signed in to change notification settings - Fork 79
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
and source
overrides not working when importing models from another project
#190
Comments
This seems to work, but not sure if 100% correct :
|
The issue might also come from this line : dbt-unit-testing/macros/utils.sql Line 77 in 49f92aa
It will throw an error as long as a used model is not from the current package. |
Hi @NicolasGuary, |
Hello @psousa50 yes exactly! |
I'm a bit confused. If project A imports project B you should be able to use models from project B in project A, not the other way around. I'm sorry if I misunderstood what you said |
Imagine you have a project "common" with models that should be shared by a set of different dbt projects for instance, you have a "custom_project_a" importing common. You define unit tests in common project (as this is where the model is implemented) but one of the common models uses a model from custom_project_a (so any custom project is supposed to have this model but that's not the point here). The unit test on the common model will fail because it won't be able to resolve the node from custom_project_a using the custom I don't know if that's clear but if you try this setup locally with your package you'll be able to reproduce |
Oh ok, now it's clear, thank you! 🙂 Let me try to find a way to fix this, not sure if it's possible, we'll see. Thank you again for your report. |
Please take a look at the latest release (0.4.0) and check if it fixes this issue. Thank you! |
It seems to have worked indeed thank's! |
@rantibi have you tried using the latest version (https://github.com/EqualExperts/dbt-unit-testing/releases) and set the correct |
@NicolasGuary yes, it didn't help. (BTW: I accidentally deleted my original question, maybe you have it in your mail and you can repost it? if not, I will write it down again, thanks) |
reposting my question again as I accidentally deleted it: I have a related issue: When I am trying to mock ref as follow:
I am getting the following error:
I found that removing this line solves the issue, but I am not sure that this is the right fix and if it doesn't breaks other things, I didn't dive into the code more then that yet. |
Hi @rantibi, your test file is in |
@psousa50 |
In that case, you should use the two-parameter version of {% call dbt_unit_testing.mock_ref('common', 'model1', {"input_format": "csv"}) %} Please try it and let me know if it works Thanks |
I have tried that, but I am getting the same error |
Hi @rantibi , Sorry for the late response, but my time has been a bit limited lately. Are you still experiencing this issue? If so, could you please share more details about your project? That would greatly help in understanding what's happening. |
Closing due to inactivity. @rantibi we are open to discussing this further if you still need it. |
Hello !
I found a bug in the
ref()
(and potentially also insource()
) macro override. Here's the setup to reproduce :project_a
in which you createmodel_a
project_b
in which :model_b
that usesmodel_a
dbt-unit-testing
inpackages.yml
ref()
andsource()
project_a
importproject_b
as a package, depending on your setup, it will look like :Now, if you try to perform a
dbt ls
command fromproject_a
, you'll have the following error :But if you remove the macro override for
ref()
it will work just fine.-> The issue is that now it simply performs a look-up in the project in which the model is defined and not in the project that imports the model which contains the model in this case
The text was updated successfully, but these errors were encountered: