SqlDust v0.1.1 supports using Ecto models
SqlDust just got a level up! As of version 0.1.1, it is possible to compose queries based on Ecto models:
import Ecto.SqlDust
City
|> select("id, name, country.name, local_weather.temp_lo")
|> where("local_weather.wdate = '2015-09-12'")
|> to_sql
SELECT
"c".id,
"c".name,
"country".name,
"local_weather".temp_lo,
"local_weather".temp_hi
FROM cities "c"
LEFT JOIN countries "country" ON "country".id = "c".country_id
LEFT JOIN weather "local_weather" ON "local_weather".city_id = "c".id
WHERE ("local_weather".wdate = '2015-09-12')
https://github.com/archan937/sql_dust#composable-queries-using-ecto-models
Read next Phoenix is Rails 5