Relative Content

Tag Archive for postgresqltransactionsprisma

Is using a big transaction for bulk uploads (of e.g. products) wrong?

I am currently writing the upload process for products in an online shop. During this process, many different and only loosely connected table entries need to be created (e.g. products, categories, tags). As I only want to write to the database when all entries succeed, I am using a transaction. However, I learned that transactions should be atomic, as in the entire opposite of what I am doing. For illustrative purposes, here is a snippet from my transaction. As you can see, I even had to up the maxWait and timeout in order for it to work.

Prisma: Is using a big transaction for bulk uploads (of e.g. products) wrong?

I am currently writing the upload process for products in an online shop. During this process, many different and only loosely connected table entries need to be created (e.g. products, categories, tags). As I only want to write to the database when all entries succeed, I am using a transaction. However, I learned that transactions should be atomic, as in the entire opposite of what I am doing. For illustrative purposes, here is a snippet from my transaction. As you can see, I even had to up the maxWait and timeout in order for it to work.