-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
partial parsing: support overlapping sets of files by parser #1778
Comments
Hey @kjgorman - thanks for the thorough writeup! I think a good approach for your use case is to decouple your model and test definitions. The approach I would recommend would be to:
While this approach will require you to make two files for each validation query, it will also allow you to configure each resource independently. You could, for instance, configure the model to be materialized as a More broadly, I want dbt's top-level file paths (
and
Since these blocks define resources explicitly, they could live side-by-side in a given directory (or even in the same file!). I think this approach does a good job of 1) explicitly defining resources and 2) keeping related logic close together. When we add these blocks to dbt, I'll feel a lot better about allowing multiple parsers to operate in the same directories. Check out some related issues: Very happy to discuss this further - keen to hear what you think. |
Hey @drewbanin — thanks for writing that out for me, and sorry it's taken me so long to get back to you! The approach you describe makes sense to me — I've refactored our validation tests today to use the simple refs and resolved the issue. It's a little unwieldy to manage the extra files, but we'll see if it's really a problem in practice—we were thinking a small helper shell function to generate the boilerplate might suffice. The approach of explicit tagging with blocks is nice — with the path-based "convention over configuration" model, running into this error by using a somewhat irregular directory structure made the error more or less indecipherable until I'd spent some time debugging the parser source code. |
Yeah - I totally buy that. I saw another report of a user that put a |
Describe the feature
Basically a feature request to track this TODO: https://github.com/fishtown-analytics/dbt/blob/f9c8442260e48bdd8bb7805b2e7541ab91492bb1/core/dbt/loader.py#L128-L130
I have a scenario where there are some overlapping model and test files which fails to be partially parsed:
In this instance, we have a validation table which we want to also generate an output data set to be observed outside of a test run, so the files are processed by both
dbt.parser.models.ModelParser
anddbt.parser.data_test.DataTestParser
. (Perhaps there's some other way of achieving this that I'm not aware of—I'm quite new to dbt—which would obviate the need for this ticket.)Looking briefly through the cached node processing, it seems like processing an already parsed file isn't actually a function contingent on what parser is reading the files, so it would perhaps be possible to simply skip files that are already added:
Although of course the presence of the TODO suggests there's more to it.
Describe alternatives you've considered
Additional context
Who will this benefit?
Me! 🙂
The text was updated successfully, but these errors were encountered: