def execute(conn, sql_stmt):
    """Execute the given sql statement and return True on success

    Args:
        conn: a database connection, this function will leave it open
        sql_stmt: the sql statement to execute

    Returns:
        True on success and False on failure
    """
    if conn.driver == "maxcompute":
        inst = conn.execute_sql(sql_stmt)
        return inst.is_successful()
    else:
        cur = conn.cursor()
        try:
            cur.execute(sql_stmt)
            conn.commit()
            return True
        except:  # noqa: E722
            return False
        finally:
            cur.close()