fuelen
Ecto.DevLogger - an alternative logger of SQL queries in development
Ecto.DevLogger is an alternative logger of SQL queries in development
It inlines bindings into the query, so it is easy to copy-paste logged SQL and run it in any IDE for debugging without manual transformation of common elixir terms to string representation (binary UUID, DateTime, Decimal, json, etc). Also, it highlights db time to make slow queries noticeable. Source table and inlined bindings are highlighted as well.
Links
Most Liked
fuelen
v0.4.0 has been released ![]()
Now, we support multiple repos and Ecto.Adapters.MyXQL adapter.
BartOtten
This has been added to Ecto.
- [Ecto.Repo] Log human-readable UUIDs by using pre-dumped query parameters
Still eager to give this lib a try. Good work!
fuelen
The library design is based on guessing the suitable type by the shape of the parameter. This means there is a chance of an incorrect representation of the parameter. Here are a couple of examples:
- Invalid SQL generated for JSON fragment · Issue #21 · fuelen/ecto_dev_logger · GitHub
- 16 character string converted to UUID · Issue #9 · fuelen/ecto_dev_logger · GitHub (It is possible to fix this by adding some special conditions for UUIDs, and I think I’ll do this eventually
)
To get rid of guessing, we need more low-level information about types, like Postgrex.Extensions.UUID, Postgrex.Extensions.JSONB, etc. But even Ecto doesn’t operate these types as the modules mentioned above are not public
https://github.com/elixir-ecto/postgrex/blob/c0eb94e3d3538bd52a3a8334ad66d7c243583fea/lib/postgrex/extensions/uuid.ex#L2
Moreover, not all database adapters even have similar type representation.
Here is a related discussion https://groups.google.com/g/elixir-ecto/c/5AwUoaEuq4E/m/J9Kbr9FOBAAJ?pli=1
In summary, to have this feature in Ecto, it probably should be implemented on the DB adapter level.
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










