Ecto / Phoenix API to create and manage DB procedures

Is there such a thing?

Ecto doesn’t support procedures (I think) but, you can go with them through the SQL adapter, something like:

Ecto.Adapters.SQL.query(MyRepo, "stored_procedure(?, ?)", [param1, param2])

Another approach can be the fragments

2 Likes

4 years on, is this still a valid answer ? Basically, I want to create procedures using Ecto migrations, is that possible ?

You should be able to create them by passing the SQL to Repo.query

The only gotcha I recall is that using them in FROM clauses isn’t supported.