I’ve never tried Citus and have somewhat limited knowledge of all its moving parts, but using Ecto (or just plain Postgrex) should absolutely be feasible. Naturally Ecto/Postgrex won’t handle getting the extension on the PostgreSQL server in the first place, but the commands to install it into a database are all fair game.
If the reason you want Ecto is related to migrations, look at: Ecto.Migration.execute/1 (or /2) Ecto.Migration — Ecto SQL v3.10.2. The CREATE EXTENSION
command minimally would have to be done that way (as far as I recall). The Ecto migrations do have DSL for creating tables, but not sure if there’s a way to get the USING columnar
in with that DSL. There is Ecto.Migration.fragment/1, but looking over the docs its not nearly so flexible as the fragment
function in the query DSL.
As for querying, non-standard PostgreSQL types may need to be represented by custom Ecto & Postgrex types. I haven’t made any for awhile, but they’re pretty straightforward: Ecto.Type — Ecto v3.10.3 & Postgrex.Types — Postgrex v0.17.3.
Anyway, there are other people here who may be more helpful than this or with direct experience trying to use Citus… but for now this should give you some avenues to explore.