On Fri, Jan 31, 2020 at 7:56 PM R.Wieser <address@not.available> wrote: > > Dennis, > > > A full client/server RDBM should never be affected by an abort > > of a client program. > > What you describe is on the single query level. What I was thinking of was > having several queries that /should/ work as a single unit, but could get > interrupted (because of the OPs ctrl-c). > > Yes, Chris was probably right about using a transaction to fix that, but > that has to be learned - knowledge I do not take for granted with a > hobbyist. >
Do you also permit people to drive cars without knowing about the handbrake? When you start using a database, you have to learn how to speak its language (usually SQL). Transactions are part of that. What is so hard about this? They're not some esoteric thing that only a few people use. EVERY request to a PostgreSQL database (and many other DBMSes) is part of a transaction, whether implicit or explicit. I Googled "postgres python tutorial". The first hit was https://www.postgresqltutorial.com/postgresql-python/ and it mentions transactions in the very first section, on connecting to the database. Second hit: https://pynative.com/python-postgresql-tutorial/ - the word "transaction" comes up on the landing page, albeit part way down; but the first example that does any mutation does use an explicit commit. I didn't check for SQLAlchemy but it's likely the same. Use transactions. Learn them. ChrisA -- https://mail.python.org/mailman/listinfo/python-list