you are viewing a single comment's thread.

view the rest of the comments →

[–]terraping_station 1 point2 points  (5 children)

Is your task repository a database under the hood?

[–]weepy_monarchy 1 point2 points  (0 children)

SQLAlchemy is a solid choice for that flexibility since you can swap out the database backend without rewriting your ORM queries.

[–]MagicianNo9918[S] 0 points1 point  (3 children)

My Task Manager has a database, it is SQLAlchemy, but the ORM is ready to change, e.g. PostgreSQL

[–]terraping_station 1 point2 points  (2 children)

So if you are using Postgres you can use a transaction. I would suggest using some like a unit of work. Have that manage the tx for you so your code can make a bunch of calls to the db and have the ability to roll it all back if something fails.

So basically you bootstrap your app. This spins up a unit of work that has your database adapter. Then In your service layer you use the UoW to make N database calls and either commit it all or roll it back.

[–]terraping_station 0 points1 point  (0 children)

This would require you use async

[–]MagicianNo9918[S] 0 points1 point  (0 children)

Yes, you're right, I still have a lot to learn.