This talk is about big ideas around Ecto structure and how  to use it.

Ecto follows the Repository Pattern (https://stackoverflow.com/q/11985736/6782635) for data access, it is a centralized class connected to a database, the rest of the operations are sent to the repository. There is different way to update a value with Ecto, by using Changeset for example. Every time you see the word "Repo", the code is talking to the database.

Ecto is Explicit. The schema definition is pretty easy to use, we need to use Ecto.Schema (https://hexdocs.pm/ecto/Ecto.Schema.html) module, define a schema with schema (https://hexdocs.pm/ecto/Ecto.Schema.html#schema/2) and define different fields in the specific schema.

Ecto supports notion of association and how to define relation between table. A schema can be connected to another schema by using belongs_to function (https://hexdocs.pm/ecto/Ecto.Schema.html#belongsto/3). In the other schema, we can now define the other part of the association with has_many (https://hexdocs.pm/ecto/Ecto.Schema.html#has_many/3) or has_one (https://hexdocs.pm/ecto/Ecto.Schema.html#has_one/3) functions.

Associations should me loaded to see the data associated with the schema. Ecto doesn't support Lazy Loading, you need to define exactly what data you need to load with Repo.preload/2 function (https://hexdocs.pm/ecto/Ecto.Repo.html#c:preload/3).

Ecto manipulated operations and SQL queries/requests as data-structure. We have 3 ways of using these data-structure: with Query module (https://hexdocs.pm/ecto/Ecto.Query.html), an integrated version of SQL in Elixir, these queries are composable and reusable.

Changeset (https://hexdocs.pm/ecto/Ecto.Changeset.html) module and data-structure defines how to filter , validate the data and capture errors. To create a Changeset, we need to cast the structure and pipe it in different Changeset function present in the module. Validation is part of the changeset and not of the schema, because validation can change during the evolution of your application. Multiple changesets can me set at the same time.

Multi module (https://hexdocs.pm/ecto/Ecto.Multi.html) can manage multiple operations at the same time, as transaction. If something fail during a multiple operation, we go back in the last state without pushing data in the database. Nothing happened if we don't call Repo.transaction function (https://hexdocs.pm/ecto/Ecto.Repo.html#c:transaction/2). Multi can run arbitrary piece rof code, like sending an email when we insert something in the database. Data-structure can be composed and reuse somewhere else in the code.

If you don't need schema, it is not mandatory to use it, queries can be written only with Query module (https://hexdocs.pm/ecto/Ecto.Query.html). Schema can be bended, it is possible to add virtual field by using virtual option, it permit to define, for example, two type of data, string, and integer, to be stored in the same place. This feature is used directly with changeset.

Embedded schema (https://hexdocs.pm/ecto/Ecto.Schema.html#embedded_schema/1) can be used to define "virtual" schema, and add more flexibility to some data which can fit perfectly in the database.

A good thing about Ecto is you can pick what you need and drop the rest. Use only what it is useful for you.