blob: f6fff4a3d6f683a0d6e11020d0cd13e60d1a0090 [file] [log] [blame]
:py:mod:`airflow.providers.presto.hooks.presto`
===============================================
.. py:module:: airflow.providers.presto.hooks.presto
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.presto.hooks.presto.PrestoHook
Functions
~~~~~~~~~
.. autoapisummary::
airflow.providers.presto.hooks.presto.generate_presto_client_info
Attributes
~~~~~~~~~~
.. autoapisummary::
airflow.providers.presto.hooks.presto.DEFAULT_FORMAT_PREFIX
.. py:data:: DEFAULT_FORMAT_PREFIX
:annotation: = airflow.ctx.
.. py:function:: generate_presto_client_info()
Return json string with dag_id, task_id, execution_date and try_number
.. py:exception:: PrestoException
Bases: :py:obj:`Exception`
Presto exception
.. py:class:: PrestoHook(*args, schema = None, **kwargs)
Bases: :py:obj:`airflow.hooks.dbapi.DbApiHook`
Interact with Presto through prestodb.
>>> ph = PrestoHook()
>>> sql = "SELECT count(1) AS num FROM airflow.static_babynames"
>>> ph.get_records(sql)
[[340698]]
.. py:attribute:: conn_name_attr
:annotation: = presto_conn_id
.. py:attribute:: default_conn_name
:annotation: = presto_default
.. py:attribute:: conn_type
:annotation: = presto
.. py:attribute:: hook_name
:annotation: = Presto
.. py:method:: get_conn(self)
Returns a connection object
.. py:method:: get_isolation_level(self)
Returns an isolation level
.. py:method:: insert_rows(self, table, rows, target_fields = None, commit_every = 0, replace = False, **kwargs)
A generic way to insert a set of tuples into a table.
:param table: Name of the target table
:param rows: The rows to insert into the table
:param target_fields: The names of the columns to fill in the table
:param commit_every: The maximum number of rows to insert in one
transaction. Set to 0 to insert all rows in one transaction.
:param replace: Whether to replace instead of insert