blob: 9da54e1c5c0f16232c57dc60f371294279246203 [file] [log] [blame]
:py:mod:`airflow.providers.trino.hooks.trino`
=============================================
.. py:module:: airflow.providers.trino.hooks.trino
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.trino.hooks.trino.TrinoHook
Functions
~~~~~~~~~
.. autoapisummary::
airflow.providers.trino.hooks.trino.generate_trino_client_info
Attributes
~~~~~~~~~~
.. autoapisummary::
airflow.providers.trino.hooks.trino.DEFAULT_FORMAT_PREFIX
.. py:data:: DEFAULT_FORMAT_PREFIX
:annotation: = airflow.ctx.
.. py:function:: generate_trino_client_info()
Return json string with dag_id, task_id, execution_date and try_number
.. py:exception:: TrinoException
Bases: :py:obj:`Exception`
Trino exception
.. py:class:: TrinoHook(*args, schema = None, **kwargs)
Bases: :py:obj:`airflow.hooks.dbapi.DbApiHook`
Interact with Trino through trino package.
>>> ph = TrinoHook()
>>> sql = "SELECT count(1) AS num FROM airflow.static_babynames"
>>> ph.get_records(sql)
[[340698]]
.. py:attribute:: conn_name_attr
:annotation: = trino_conn_id
.. py:attribute:: default_conn_name
:annotation: = trino_default
.. py:attribute:: conn_type
:annotation: = trino
.. py:attribute:: hook_name
:annotation: = Trino
.. 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