Quantcast
Channel: Design Bit
Viewing all articles
Browse latest Browse all 38

How to show all Ecto query data in iex.

$
0
0

Here’s a quick tip for those times when you’re querying Ecto data in iex.

You’re running a query in your terminal using iex -S mix, and the data you’re getting back is truncated at the end.

%MyApp.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">,
confirmation_code: nil, desktop_notification_preference: "everything",
disabled: false, email: "example@email.com", ...},
%MyApp.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">,
confirmation_code: nil, desktop_notification_preference: "everything",
disabled: false, ...},
%MyApp.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">,
confirmation_code: nil, desktop_notification_preference: "everything", ...},
%MyApp.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">,
confirmation_code: nil, ...},
%MyApp.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">, ...},
%MyApp.Accounts.User{...}, ...]

Here’s how you can get all the query data rendered in your terminal — no longer truncated!

MyApp.User |> MyApp.Repo.all |> IO.inspect(limit: :infinity)

The will cause all the data to be rendered completely in the terminal.

Enjoy!


How to show all Ecto query data in iex. was originally published in sergiotapia on Medium, where people are continuing the conversation by highlighting and responding to this story.


Viewing all articles
Browse latest Browse all 38

Trending Articles