Search⌘ K
AI Features

Overview of Part II

Explore advanced topics in Ecto including performance tuning, sandbox testing, Phoenix integration, custom types, polymorphic associations, and flexible schemas. Learn how to enhance your Elixir applications by applying these skills in practical scenarios to improve database interactions and testing efficiency.

We'll cover the following...

With the knowledge acquired in Part I, we’ll look at some more advanced use cases that often come up with Ecto and database programming in general. We’ll cover performance tuning, speeding up our tests with sandboxes, integrating Ecto with Phoenix, and so on. Each chapter is distinct, so feel free to jump directly into the topics you’re most interested in and look at the others later on.

Structure of Part II: Ecto Applied

This section has eleven chapters:

  1. Add Ecto to an Elixir Application Without Phoenix gives step-by-step instructions on setting up an Elixir application with Ecto.

  2. Work with Changesets and Phoenix Forms shows how to use Ecto changesets with Phoenix forms. We’ll also learn how to create forms with associations.

  3. Test with Sandboxes gives an overview of using sandboxes with Ecto to run our test suites and their various benefits.

  4. Create and Use Custom Types talks about how to create custom types when there’s a need to use a data type not directly supported by Ecto.

  5. Insert and Update with Upserts introduces upserts and how to use them in Ecto with or without schemas.

  6. Optimizing Your Application Design introduces techniques for optimizing Elixir applications. In addition, we’ll learn about contexts and umbrella applications.

  7. Work with Embedded Schemas shows how to work with embedded schemas. We’ll also learn when to prefer embedded schemas over associations and when not to.

  8. Creating Polymorphic Associations shows various ways of implementing polymorphic associations in Ecto.

  9. Optimizing IEx for Ecto discusses how to customize IEx using the .iex.exs file.

  10. Using Schemas Without Tables talks about the downsides of locking schemas to tables and the advantages of keeping them flexible. We’ll learn how to work with schemas without tables.

  11. Tuning for Performance demonstrates various techniques we can use to tune Ecto for better performance.