Languages may come and go, but the relational database endures. Learn how to use Ecto, the premier database library for Elixir, to connect your Elixir and Phoenix apps to databases. Get a firm handle on Ecto fundamentals with a module-by-module tour of the critical parts of Ecto. Then move on to more advanced topics and advice on best practices with a series of recipes that provide clear, step-by-step instructions on scenarios commonly encountered by app developers. Co-authored by the creator of Ecto, this title provides all the essentials you need to use Ecto effectively.
Elixir and Phoenix are taking the application development world by storm, and Ecto, the database library that ships with Phoenix, is going right along with them. There are plenty of examples that show you the basics, but to use Ecto to its full potential, you need to learn the library from the ground up.
This definitive guide starts with a tour of the core features of Ecto - repos, queries, schemas, changesets, transactions - gradually building your knowledge with tasks of ever-increasing complexity. Along the way, you'll be learning by doing - a sample application handles all the boilerplate so you can focus on getting Ecto into your fingers.
Build on that core knowledge with a series of recipes featuring more advanced topics. Change your pooling strategy to maximize your database's efficiency. Use nested associations to handle complex table relationships. Add streams to handle large result sets with ease. Based on questions from Ecto users, these recipes cover the most common situations developers run into.
Whether you're new to Ecto, or already have an app in production, this title will give you a deeper understanding of how Ecto works, and help make your database code cleaner and more efficient.
What You
To follow along with the book, you should have Erlang/OTP 19+ and Elixir 1.4+ installed. The book will guide you through setting up a sample application that integrates Ecto.
When I've started reading it, I was wondering - so, is it the time, will this one be the first non-awesome PragProg's book on Elixir (+its landscape)? The answer is simple: we have to wait longer, the book is top notch.
I didn't consider myself to be a world-class expert, but the word "capable" was far more natural (for me to describe myself), but I have to admit I've still learned some new stuff. Even if this book doesn't assume any prior experience with Ecto, I didn't feel bored and I haven't skip any part - quite the contrary. The book is well written, samples and examples are far from being boring, I haven't identified any explicit sub-topics I'd put in the book. Obviously, there's ALWAYS something to add, but you shouldn't go over-the-board with book's size: it may appear too intimidating for beginners.
I've honestly spent some time thinking about potential issues/drawbacks, but nothing non-trivial came to my mind. If you're about to write Elixir code that accesses RDBMSes, this book is a real help. Unconditionally recommended.
Really useful on understanding Ecto and how it was intended to be used. While learning Phoenix I needed to use Ecto but was feeling I was missing a number of key concepts about this library. This book filled in the holes and I'd recommend it for anybody using Ecto. It's not long and easy to read. Note this is based on the beta 5 release. There are still a couple of more chapters before the final release.
A quick read that helped me build a solid mental model of how the different modules in the Ecto library work together. I like programming books that explain the lib contributors' original intent and goals for a module - helps with my understanding more than a pile of examples does.
One thing that is missing from almost all programming books is a "Deciphering Error Messages" section. While Ecto error messages are pretty good, it would be nice to have a short explainer of some of the more common errors and how to prevent them.
This was a good and helpful resource, I learned a good deal about Ecto. Interestingly, I felt the bit about bounded contexts and application design to be particularly helpful. I think a good deal of that has been glazed over and/or assumed in other resources. This was much more clear in the handling of the topic.
The first part of the book is a simple summary of the Ecto documentation, with some questionable suggestions in the chapter about migrations.
The second part is more interesting, it contains some neat tricks, for example, using changesets without schema and different ways to implement polymorphic associations.