Member-only story

Transaction in MySQL Shell — Python mode with examples

Josh Otwell
12 min readApr 15, 2020

--

Although my day job has lately been filled primarily with MySQL and PHP development — which I absolutely enjoy — I still make spare time for MySQL and Python hacking; particularly in the MySQL Shell. For whatever reason, I am drawn back to this specific environment. SAVEPOINT, COMMIT, and START TRANSACTION are integral commands for working within a database transaction. MySQL Shell fully supports these commands. We can even execute them in Python mode! Continue reading to see them in action…

Photo by Jonas Jacobsson on Unsplash

OS, Software, and DB used:

  • OpenSuse Leap 15.1
  • MySQL 8.0.19

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

MySQL Shell Session Information

We need some session information for working in the shell with TRANSACTION‘s. The following transaction methods are all part of the Session class that is utilized in the example queries that follow:

  • start_transaction()
  • commit()
  • rollback()
  • rollback_to() – Requires a…

--

--

Josh Otwell
Josh Otwell

Written by Josh Otwell

SQL/PHP | Photography | Technical Consultant. Sign-up for my free developer newsletter, OpenLampTech, here: openlamptech.substack.com

No responses yet