airflow.providers.exasol.hooks.exasol
¶
Module Contents¶
Classes¶
Interact with Exasol. |
- class airflow.providers.exasol.hooks.exasol.ExasolHook(*args, **kwargs)[source]¶
Bases:
airflow.providers.common.sql.hooks.sql.DbApiHook
Interact with Exasol. You can specify the pyexasol
compression
,encryption
,json_lib
andclient_name
parameters in the extra field of your connection as{"compression": True, "json_lib": "rapidjson", etc}
. See pyexasol reference for more details.- get_pandas_df(sql, parameters=None, **kwargs)[source]¶
Executes the sql and returns a pandas dataframe
- export_to_file(filename, query_or_table, query_params=None, export_params=None)[source]¶
Exports data to a file.
- Parameters
filename (str) – Path to the file to which the data has to be exported
query_or_table (str) – the sql statement to be executed or table name to export
query_params (dict | None) – Query parameters passed to underlying
export_to_file
method ofExaConnection
.export_params (dict | None) – Extra parameters passed to underlying
export_to_file
method ofExaConnection
.
- run(sql, autocommit=False, parameters=None, handler=None, split_statements=False, return_last=True)[source]¶
Runs a command or a list of commands. Pass a list of sql statements to the sql parameter to get them to execute sequentially
- Parameters
sql (str | Iterable[str]) – the sql statement to be executed (str) or a list of sql statements to execute
autocommit (bool) – What to set the connection’s autocommit setting to before executing the query.
parameters (Iterable | Mapping | None) – The parameters to render the SQL query with.
handler (Callable | None) – The result handler which is called with the result of each statement.
split_statements (bool) – Whether to split a single SQL string into statements and run separately
return_last (bool) – Whether to return result for only last statement or for all after split
- Returns
return only result of the LAST SQL expression if handler was provided.
- Return type
Any | list[Any] | None
- set_autocommit(conn, autocommit)[source]¶
Sets the autocommit flag on the connection
- Parameters
conn – Connection to set autocommit setting to.
autocommit (bool) – The autocommit setting to set.
- get_autocommit(conn)[source]¶
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.
- Parameters
conn – Connection to get autocommit setting from.
- Returns
connection autocommit setting.
- Return type