-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Enable jinja2 template inheritance #1337
Comments
@fetanchaud thanks for the report! Your data vault entity use case is a really good one! I'm unsure what's involved in supporting jinja templates, though I agree that they're a powerful construct worth supporting in dbt. I can have a look at what an implementation would entail. Is this something you'd be interested in working on if we can come up with a good plan? |
Hi @drewbanin, |
hmmm, ok! In thinking about this more, a feature like this would require significant changes to internals of dbt. I'd also be happy to work on this, but I'm unsure when I'll be able to tackle it. Can you help by including some examples / test cases that we can use to validate the feature? They don't need to be realistic, but if you're able to comment with an example template and an example of a model that uses it, that would be really helpful! |
Hi @drewbanin, sorry for the delay. Best regards, |
Hi! Is there any plan to include this feature into next releases? I'm working on a model consistency monitoring tool for our data warehouse and jinja template inheritance would save me 50% of lines of code not to mention DRY. |
Hey @gherolyants - this isn't currently prioritized on our end, and I think it will be a pretty big change when it's eventually implemented! I think there are a lot of great patterns that a feature like this will facilitate. Can you tell me a little bit about the model consistency monitoring tool you're looking to build? I intuitively feel that template inheritance will be a powerful feature in dbt, but I haven't been able to pinpoint any really great use-cases that aren't served by macros! |
My use case is Snowflake has stored procedures written in javascript. It would be nice to be able to use the jinja "include" to bring in the javascript from a json file. That way when I am developing javascript in my IDE i get the benefits of all the javascript syntax highlighting and extensions. |
For my use case, we're creating a metric warehouse using |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days. |
Issue
Users cannot use jinja2 template inheritance to build models
Issue description
Given a jinja2 my_base_template.temp template file (extension is meaningless),
any model begining with {% extends "my_base_template.temp" %} fails.
Results
Error message : "no loader for this environment specified"
System information
DBT 0.12.2
python 3.7.1
windows 7
Feature
Enable jinja2 template inheritance
Feature description
Whilst jinja2 macros are of great use for code reuse, it seems to have cases when inheritance could be of great help, when one wants to reuse behavior instead.
Who will this benefit?
In my use case, I am trying to write generic models for each of the standard Data Vault entities (hub, link, satellite, etc...) on top of a persistent staging area, and inheriting from a template would be of great help not to repeat myself.
Best regards,
Fabrice Etanchaud
The text was updated successfully, but these errors were encountered: