code: def execute_transaction(conn, statements: Iterable):
      
  
      with conn:
          with conn.cursor() as cursor:
              for statement in statements:
                  cursor.execute(statement)
          conn.commit()
docs: Execute several statements in single DB transaction.