Ecto query to SQL
Ecto exposes a to_sql function on your ecto Repo. Check this out:
query = from u in User,
where: u.name == "Foo Bar",
select: [:id, :name]
Repo.to_sql(:all, query)
# {
# "SELECT t0.\"id\", t0.\"name\" FROM \"users\" AS t0 WHERE (t0.\"name\" = 'Foo Bar')",
# []
# }
Tweet