Skip to content

Add mix ecto.query #4719

@josevalim

Description

@josevalim

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions