\n",
"\n",
"Nice abstraction over the concept of atomic operations, and the\n",
"context manager makes it easy to see, visually, what blocks of code are\n",
"grouped together atomically. \n",
"\n",
"Explicit control over when a transaction starts and finishes, and our\n",
"application fails in a way that is safe by default. \n",
"\n",
"Nice place to put all your repositories so client code can access them. \n",
"\n",
"Atomicity isn’t only about transactions; it\n",
"can help us work with events and the message bus. \n",
" | \n",
"\n",
"\n",
"Most ORMs already have good abstractions around\n",
"atomicity. SQLAlchemy even has context managers. You can go a long way\n",
"just passing a session around. \n",
"\n",
"Be careful about things like rollbacks, multithreading, and nested transactions. \n",
"Perhaps just sticking to what Django or Flask-SQLAlchemy gives you will keep your life\n",
"simpler. \n",
" | \n",
"
\n",
"