| :py:mod:`airflow.providers.exasol.hooks.exasol` |
| =============================================== |
| |
| .. py:module:: airflow.providers.exasol.hooks.exasol |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.exasol.hooks.exasol.ExasolHook |
| |
| |
| |
| |
| .. py:class:: ExasolHook(*args, **kwargs) |
| |
| Bases: :py:obj:`airflow.hooks.dbapi.DbApiHook` |
| |
| Interact with Exasol. |
| You can specify the pyexasol ``compression``, ``encryption``, ``json_lib`` |
| and ``client_name`` parameters in the extra field of your connection |
| as ``{"compression": True, "json_lib": "rapidjson", etc}``. |
| See `pyexasol reference |
| <https://github.com/badoo/pyexasol/blob/master/docs/REFERENCE.md#connect>`_ |
| for more details. |
| |
| .. py:attribute:: conn_name_attr |
| :annotation: = exasol_conn_id |
| |
| |
| |
| .. py:attribute:: default_conn_name |
| :annotation: = exasol_default |
| |
| |
| |
| .. py:attribute:: conn_type |
| :annotation: = exasol |
| |
| |
| |
| .. py:attribute:: hook_name |
| :annotation: = Exasol |
| |
| |
| |
| .. py:attribute:: supports_autocommit |
| :annotation: = True |
| |
| |
| |
| .. py:method:: get_conn(self) |
| |
| Returns a connection object |
| |
| |
| .. py:method:: get_pandas_df(self, sql, parameters = None, **kwargs) |
| |
| Executes the sql and returns a pandas dataframe |
| |
| :param sql: the sql statement to be executed (str) or a list of |
| sql statements to execute |
| :param parameters: The parameters to render the SQL query with. |
| :param kwargs: (optional) passed into pyexasol.ExaConnection.export_to_pandas method |
| |
| |
| .. py:method:: get_records(self, sql, parameters = None) |
| |
| Executes the sql and returns a set of records. |
| |
| :param sql: the sql statement to be executed (str) or a list of |
| sql statements to execute |
| :param parameters: The parameters to render the SQL query with. |
| |
| |
| .. py:method:: get_first(self, sql, parameters = None) |
| |
| Executes the sql and returns the first resulting row. |
| |
| :param sql: the sql statement to be executed (str) or a list of |
| sql statements to execute |
| :param parameters: The parameters to render the SQL query with. |
| |
| |
| .. py:method:: export_to_file(self, filename, query_or_table, query_params = None, export_params = None) |
| |
| Exports data to a file. |
| |
| :param filename: Path to the file to which the data has to be exported |
| :param query_or_table: the sql statement to be executed or table name to export |
| :param query_params: Query parameters passed to underlying ``export_to_file`` |
| method of :class:`~pyexasol.connection.ExaConnection`. |
| :param export_params: Extra parameters passed to underlying ``export_to_file`` |
| method of :class:`~pyexasol.connection.ExaConnection`. |
| |
| |
| .. py:method:: run(self, sql, autocommit = False, parameters = None, handler=None) |
| |
| Runs a command or a list of commands. Pass a list of sql |
| statements to the sql parameter to get them to execute |
| sequentially |
| |
| :param sql: the sql statement to be executed (str) or a list of |
| sql statements to execute |
| :param autocommit: What to set the connection's autocommit setting to |
| before executing the query. |
| :param parameters: The parameters to render the SQL query with. |
| :param handler: The result handler which is called with the result of each statement. |
| |
| |
| .. py:method:: set_autocommit(self, conn, autocommit) |
| |
| Sets the autocommit flag on the connection |
| |
| :param conn: Connection to set autocommit setting to. |
| :param autocommit: The autocommit setting to set. |
| |
| |
| .. py:method:: get_autocommit(self, conn) |
| |
| Get autocommit setting for the provided connection. |
| Return True if autocommit is set. |
| Return False if autocommit is not set or set to False or conn |
| does not support autocommit. |
| |
| :param conn: Connection to get autocommit setting from. |
| :return: connection autocommit setting. |
| :rtype: bool |
| |
| |
| |