airflow.hooks.presto_hook¶
Module Contents¶
- 
class airflow.hooks.presto_hook.PrestoHook[source]¶
- Bases: - airflow.hooks.dbapi_hook.DbApiHook- Interact with Presto through PyHive! - >>> ph = PrestoHook() >>> sql = "SELECT count(1) AS num FROM airflow.static_babynames" >>> ph.get_records(sql) [[340698]] - 
static _get_pretty_exception_message(e)[source]¶
- Parses some DatabaseError to provide a better error message 
 - 
get_first(self, hql, parameters=None)[source]¶
- Returns only the first row, regardless of how many rows the query returns. 
 - 
get_pandas_df(self, hql, parameters=None, **kwargs)[source]¶
- Get a pandas dataframe from a sql query. 
 - 
run(self, hql, parameters=None)[source]¶
- Execute the statement against Presto. Can be used to create views. 
 - 
insert_rows(self, table, rows, target_fields=None, commit_every=0)[source]¶
- A generic way to insert a set of tuples into a table. - Parameters
- table (str) – Name of the target table 
- rows (iterable of tuples) – The rows to insert into the table 
- target_fields (iterable of strings) – The names of the columns to fill in the table 
- commit_every (int) – The maximum number of rows to insert in one transaction. Set to 0 to insert all rows in one transaction. 
 
 
 
- 
static