This is inspired by rails query:
- Add a
read_only: true option to Repo.transaction (databases that do not support it should raise)
- Add
mix ecto.query "from(p in Post, where: ...)" which will:
- Load the current dot iex if any
- import Ecto.Query
- Start a read-only transaction
- Eval the code
- And pass it to Repo.all using the default repo
- Print the results using inspect(limit: :infinity) but no more than 100 entries (controlled by
--limit flag)
Question: do we print the high-level schema data (if yes, then we should remove all association fields) or the {MyXQL,Postgrex,...}.Result struct? Rails prints the result struct. If we go with the result, then this belongs in ecto_sql (which could be beneficial as we could support a --sql flag too).
This is inspired by
rails query:read_only: trueoption to Repo.transaction (databases that do not support it should raise)mix ecto.query "from(p in Post, where: ...)"which will:--limitflag)Question: do we print the high-level schema data (if yes, then we should remove all association fields) or the {MyXQL,Postgrex,...}.Result struct? Rails prints the result struct. If we go with the result, then this belongs in
ecto_sql(which could be beneficial as we could support a--sqlflag too).