예제 #1
0
 def drop_db():
     hook = TrinoHook()
     with hook.get_conn() as conn:
         with closing(conn.cursor()) as cur:
             cur.execute(DELETE_QUERY)
             # Trino does not execute queries until the result is fetched. :-(
             cur.fetchone()
예제 #2
0
 def query(self):
     """Queries trino and returns a cursor to the results."""
     trino = TrinoHook(trino_conn_id=self.trino_conn_id)
     conn = trino.get_conn()
     cursor = conn.cursor()
     self.log.info("Executing: %s", self.sql)
     cursor.execute(self.sql)
     return _TrinoToGCSTrinoCursorAdapter(cursor)