How to rollback a set of mysql queries

Is there a simple way where MySqlHook or some other MySqlHandler can perform multiple update queries and revert/rollback if any fails?

I was hoping for something similar to a structure below:

try:
    # update query 1
    # update query 2
    # update query 3  <-- Might fail
except Exception:
    xxx.rollback()
    raise
return True

I wanted to run the generic mysql.connecter pattern but Airflow doesn’t allow import of mysql.

Solution:

mysql_execute_hook = MySqlHook(mysql_conn_id=CONNECTION_ID)
connection = mysql_execute_hook.get_conn()
try:
    cursor = connection.cursor()
    cursor.execute(...)
    cursor.execute(...)
    cursor.execute(...)
    connection.commit()
except Exception:
    connection.rollback()
    raise
finally:
    connection.close()