def execute_commit(connection, query):
    """Execute INSERT, UPDATE, DELETE sql"""

    sql = str(query)
    try:
        with connection.cursor() as cursor:
            row = cursor.execute(sql)
        connection.commit()
    except Exception as e:
        connection.rollback()
        raise e
    return row