ElixirConf2016 and Ecto

Just got back from ElixirConf2016. It was an awesome experience even with how wet Disney World was from the side effects of Hurricane Hermine. Very interesting sessions and a lot of excitement. Also seemed like a really nice community. Lots of folks coming from Rails. A couple people from Java.

There were 542 attendees and that was basically doubled from last year’s conference. A large number of people already had Elixir/Phoenix code in production - which was encouraging. I was there more as a tourist than anything. Trying to figure out if this is something that I should really try and dig into or just something to play around with. I think by the end of the conference I thought that this was something that has a real chance to be a solid development community over the next decade.

I enjoyed every talk that I went to but the one by Darin Wilson (@darinwilson) on Ecto was immediately useful and something that I was able to quickly wrap my head around with my database background. Ecto is Elixir’s database wrapper. It’s relatively new - like most of Elixir - but its really well thought out and usable.

Darin’s talk and sample project (a music db) covered a lot of Ecto use cases, including :

belongs_to :artist, Artist
has_many :tracks, Track
many_to_many :genres, Genre, join_through: "albums_genres"

Its worth checking out if you are new to Ecto. Its in github at music_db github repo.

The actual database access is provided by an Adapter that implements a set of callbacks and a driver that implements the database communication protocol (it appears - I’m still learning this myself). The default relational database is Postgres (good choice!).

Ecto just released version 2.0 and the only Adapter that appears to work at this point is Postgres. MySQL and MongoDB were supported < 2.0 so hopefully support for them is added back shortly.

The preferred syntax to form queries is key-word based. This should work well for standard database models. Again, there are decent examples in Darin’s sample project.

Will be spending a few hours trying to wrap my head around using Ecto for a work model of Users, Roles, Accounts, etc.

Written on September 3, 2016