Using Postgres COPY with Elixir/Ecto

This post is about using Postgres COPY to retrieve data from the database into memory when using Elixir and Ecto. Let’s assume you want to read all the data from a table ‘accounts’ using Postgres COPY. Lets assume the table definition in Postgres is:

Read More

Elixir, Phoenix and Ecto fragment and SIMILAR TO

I had a part of a Phoenix web app where users wanted to save filters to the database and then be able to select and apply them to narrow a dataset. One of the key features that they wanted was the ability to wildcard search the fqdn column value (fqdn is fully qualified domain name in this case). Creating the filter and saving the data was fairly straightfoward but how could I use Ecto to apply “n” number of LIKE operators?

Read More

Elixir, Phoenix and Default Logging

If you are using the default Logger in your Elixir/Phoenix web app with no further configuration then your logs will rotate rather quickly. If you are using Distillery then, by default, your log files will be in var/log and they’ll be named like:

Read More

Elixir, Phoenix and Using Agent for State

One of the real joys of Elixir is how easy it makes solving problems that are relatively difficult or tedious in other languages. A lot of this comes via wrapping the facilities in the underlying Erlang language and OTP. One of the areas that I’ve just had an opportunity to explore are GenServer and Agent.

Read More