def drop_db(): hook = PrestoHook() with hook.get_conn() as conn: with closing(conn.cursor()) as cur: cur.execute(DELETE_QUERY) # Presto does not execute queries until the result is fetched. :-( cur.fetchone()
def query(self): """Queries presto and returns a cursor to the results.""" presto = PrestoHook(presto_conn_id=self.presto_conn_id) conn = presto.get_conn() cursor = conn.cursor() self.log.info("Executing: %s", self.sql) cursor.execute(self.sql) return _PrestoToGCSPrestoCursorAdapter(cursor)