Replies: 2 comments 6 replies
-
I would love it if dbt could have different SQL "compilers" in a language agnostic way, perhaps via a plugin system. dbt could articulate the necessary inputs / outputs (very similar to the Python models that are currently in beta). Imagine if I could have one dbt model that is written in These would be optional "templaters," kind of a souped-up version of what jinja-sql does today Of course this would make static analysis of dbt projects .. difficult! OTOH, maybe not so much more difficult |
Beta Was this translation helpful? Give feedback.
-
Hi @dataders — thanks for kicking this off! I had discussed the possibility of a PRQL plugin a few weeks ago with @jtcohen6 & @lostmygithubaccount (Cody!) and we agreed to start a broader discussion with the intent of implementing this when I was back. I'm including some notes from our emails and Zoom. For context, I'm a maintainer of PRQL, and a huge dbt fan since the ancient days of 2019. Goals
Proposal(I'm using "PRQL" here but depending on how general this becomes, that could be a generic adapter) We'd need three methods for PRQL to communicate with dbt:
Two options for these:
I think the main tradeoff is that Jinja is simpler to implement, but the API approach is more general, and would allow languages which can't contain Jinja to be syntactically correct. How generic?It's worth discussing how generic this should be, so we don't over-build something at first. There's a spectrum:
A couple of thoughts on the value of starting with something generic:
Existing stateCurrently there is a plugin https://github.com/prql/dbt-prql, which does extreme python hackery to monkeypatch dbt's jinja environment whenever dbt is imported. It unfortunately only supports DBs which use backticks, like BigQuery (this is because we can't get the model before refs have been replaced; I can explain more if anyone is interested...). It would likely be less work to implement this properly! Path forwardAssuming we can agree on an approach, I'd be happy to contribute the PRQL integration and the changes needed to I would vote to do something less abstract, prove the concept, and then make it more generic later. So that would mean doing "Jinja", and (1) or (2.i) / (2.ii) in the "How generic?" options above. That would then be easy to extend to "API" and (3) & (4) as we gained more experience. But very open-minded to other ideas. |
Beta Was this translation helpful? Give feedback.
-
The dbt labs community has found great success in SQL-based data warehousing by making the work as smooth and performant as possible. Concurrently, python also found profound adoption amongst data professionals. While Python dbt models are only a single step in the direction of language-agnosticism for working with data, that step places us firmly in the land of “Not Only SQL''. This is well on the way to: “use whatever language you want”, as long as your database can interpret and execute what you’ve written performantly. So, sure, maybe R support comes next, but what about a language plugin that enables you to write the fashionable and ergonomic PRQL. and dbt and Snowpark abstract the tedium away from you and it just works. Imagine a world where the perpetual Python vs. R vs SQL debate is made redundant! What future do you imagine for input languages?
Beta Was this translation helpful? Give feedback.
All reactions