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
dbt templater should be updated to use the same source slicing/mapping algorithm as the Jinja templater (i.e. JinjaTracer) #1783
Comments
I captured a call stack for the SQLFluff dbt templater -> dbt -> Jinja:
|
From
Nothing too exotic looking. |
The main technical challenge for this work is that
dbt is a fast-moving, relatively young project. Rather than rely on dbt internals, I think the best option may be to monkeypatch Jinja to "intercept" the calls to We might also consider reaching out to the dbt community and/or creating a PR to basically split
and to expose the first function publicly for use by SQLFluff. |
What do you think about the proposal here, @alanmcruickshank? |
I think your idea of monkey patching feels the most pragmatic for now. I can ask the dbt crew about their internal API but if I was them I wouldn't want someone depending on the internal API like that. The parts of the dbt templater that already reference internals are the ones that often need changing so relying on a more stable project like Jinja to do the patching feels good. This has the added benefit that we can do something similar if any other tools also rely on Jinja in the future 👍 |
In issue #1437 (and the PR #1678), the Jinja templater was updated with a new, more robust source slicing/mapping algorithm. The dbt templater should be updated to use the same algorithm.
The text was updated successfully, but these errors were encountered: