Ecto: From the Ground Up

Beginner, Intermediate
Darin Wilson
Eric Meadows-Jönsson

Ecto is a library for connecting Elixir code to relational databases. It's the default database library that ships with Phoenix, so many developers first encounter it there. But Ecto is a large library with a lot of parts, and it's easy to feel confused about what it can do, and how to use it effectively. If you're new to Ecto, or just want to get a better handle on it, this workshop is for you.

You'll get a guided tour of all of the main components of Ecto, and build up your skillset one step at a time. We'll start by looking how Ecto implements the repository pattern for data access, then learn how to write queries using Ecto's elegant but powerful query syntax. We'll then create schemas to convert database records to and from Elixir structs, and learn how to use changesets to help manage updates to those records safely and reliably.

We'll put it all together with a deep dive into associations: Ecto's mechanism for working with relationships between tables. We'll look at detailed examples of all the types of associations Ecto offers, and learn about best practices for creating and updating collections of related records.

Along the way, you'll be learning in the most effective way possible: by writing code yourself. At each step, you'll be given exercises to reinforce what you're learning, and get Ecto's APIs into your fingers. You'll walk out with a solid grounding in how Ecto works, and you'll be ready to start working with it effectively and confidently.

This class taught: Wednesday