prql icon indicating copy to clipboard operation
prql copied to clipboard

Elixir Binding + Ecto Usage?

Open Nezteb opened this issue 2 years ago β€’ 1 comments

What's up?

Currently the Elixir binding compiles PRQL strings into SQL strings.

I think it'd be even cooler for there to be an Ecto adapter for PRQL:

  • https://hexdocs.pm/ecto/Ecto.Adapter.html
  • https://hexdocs.pm/ecto/Ecto.Query.html
  • https://hexdocs.pm/ecto_sql/Ecto.Adapters.SQL.html
  • http://blog.plataformatec.com.br/2018/11/building-a-new-mysql-adapter-for-ecto-part-i-hello-world/

I might try a super barebones implementation at some point, but I figured I'd see what y'all think first. πŸ˜„

Also, only slightly related, but it looks like the Elixir binding isn't on Hex yet? If y'all are willing to publish it (even in an early pre-release state so others can play with it), that'd be greatly appreciated. πŸ™

Nezteb avatar Oct 01 '23 18:10 Nezteb

Thanks for the issue @Nezteb

We'd be keen for it to be published on Hex! https://github.com/PRQL/prql/issues/1510 stalled but we'd be happy for someone to take that up...

I think it'd be even cooler for there to be an Ecto adapter for PRQL:

Yes that could be cool. The long-term vision of PRQL is that it could be a database-agnostic standard which could act as a target, so could work there. It would need to take an existing adapter in order to send the query.

Though one issue with integrations between two new-ish tools is that the intersection between them can be limiting β€”Β the audience can be the square of a small number, and the bugs/constraints can be the square of a big number. But if there's some synergy, then those can both be mitigated. (And personally I'm a big fan of Ecto, and listed it in the original inspirations for PRQL in our FAQ)

max-sixty avatar Oct 02 '23 19:10 max-sixty