1

I uses pyhive in jupyter to connect to hive/presto for some adhoc analysis. Something annoying is if I cancel a submitted query job via 'ctrl + c', it only stops the jupyter, but won't stop the query job remotely. Is there a way, when 'ctrl + c', it also sent a signal to stop the remote job?

def get_data_from_presto(sql):
    conn = presto.connect(...)
    cursor = conn.cursor()
    cursor.execute(sql)
    while cursor.poll() is not None:
        response_json = cursor.poll()
        time.sleep(2)
    col_names = [i[0] for i in cursor.description]
    df = pd.DataFrame(cursor.fetchall(), columns=col_names)
user1269298
  • 717
  • 2
  • 8
  • 26

0 Answers0