Why do you use Ecto.Multi?

Hello!
I’m a beginner programmer from Japan.

I’m using phoenix for my database server. In development of the database server, I have never used Ecto.Multi just because I’m not familiar with it.
I read summary of Ecto.Multi, but I don’t get when I should adopt it well.

So what I want to ask you is, Why do you use Ecto.Multi?

This ebook would be really helpful for you (not only in Ecto.Multi):

It’s free and there is no sense to copy-paste it’s contents. I really recommend reading it.

1 Like

Thanks :smile:
Did you write the book?

Link in the thread says 404 page not found

I’ve updated the link in that post. The new correct link is
https://dashbit.co/ebooks/the-little-ecto-cookbook

4 Likes

Nope, but helped a bit. By e-mail I got early releases of it and found few small issues like typos or mistake in code. :slight_smile:

Ah, right - they changed it, I heard about change to dashbit, but completely forgot about it in this topic - I have downloaded pdf on disk and not checked their pages since that. Thanks for update.

2 Likes

Ecto.Multi is used to execute SQL using transactions.
A transaction is the execution of multiple concurrent SQL operations with data integrity.
If you would like to know about a book written in Japanese, please contact me.

2 Likes

No problem! And it was the correct link when you initially posted the thread.

One concrete use case I have for Ecto.Multi is creating oban (GitHub - sorentwo/oban: 💎 Robust job processing in Elixir, backed by modern PostgreSQL or SQLite3) jobs when inserting or updating associated records.

2 Likes

Using transactions is important for developing database server as you have ever said!

I have to understand SQL and Database more.
Thank you for many answers! :smiling_face_with_three_hearts:

1 Like

I’ve been looking for this kind of resource. Thanks a ton!