:mod:`airflow.hooks.presto_hook` ================================ .. py:module:: airflow.hooks.presto_hook Module Contents --------------- .. py:exception:: PrestoException Bases::class:`Exception` .. py:class:: PrestoHook Bases::class:`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]] .. attribute:: conn_name_attr :annotation: = presto_conn_id .. attribute:: default_conn_name :annotation: = presto_default .. method:: get_conn(self) Returns a connection object .. staticmethod:: _strip_sql(sql) .. staticmethod:: _get_pretty_exception_message(e) Parses some DatabaseError to provide a better error message .. method:: get_records(self, hql, parameters=None) Get a set of records from Presto .. method:: get_first(self, hql, parameters=None) Returns only the first row, regardless of how many rows the query returns. .. method:: get_pandas_df(self, hql, parameters=None) Get a pandas dataframe from a sql query. .. method:: run(self, hql, parameters=None) Execute the statement against Presto. Can be used to create views. .. method:: insert_rows(self, table, rows, target_fields=None) A generic way to insert a set of tuples into a table. :param table: Name of the target table :type table: str :param rows: The rows to insert into the table :type rows: iterable of tuples :param target_fields: The names of the columns to fill in the table :type target_fields: iterable of strings