airflow.providers.exasol.hooks.exasol
¶
Module Contents¶
Classes¶
Interact with Exasol. |
Functions¶
|
|
|
Attributes¶
- 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]¶
Execute the SQL and return a Pandas dataframe.
- Parameters
sql – The sql statement to be executed (str) or a list of sql statements to execute.
parameters (Iterable | Mapping[str, Any] | None) – The parameters to render the SQL query with.
Other keyword arguments are all forwarded into
pyexasol.ExaConnection.export_to_pandas
.
- export_to_file(filename, query_or_table, query_params=None, export_params=None)[source]¶
Export 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
.
- static get_description(statement)[source]¶
Get description; copied implementation from DB2-API wrapper.
For more info, see https://github.com/exasol/pyexasol/blob/master/docs/DBAPI_COMPAT.md#db-api-20-wrapper
- Parameters
statement (pyexasol.ExaStatement) – Exasol statement
- Returns
description sequence of t
- Return type
Sequence[Sequence]
- run(sql: str | Iterable[str], autocommit: bool = ..., parameters: Iterable | Mapping[str, Any] | None = ..., handler: None = ..., split_statements: bool = ..., return_last: bool = ...) None [source]¶
- run(sql: str | Iterable[str], autocommit: bool = ..., parameters: Iterable | Mapping[str, Any] | None = ..., handler: Callable[[Any], T] = ..., split_statements: bool = ..., return_last: bool = ...) tuple | list[tuple] | list[list[tuple] | tuple] | None
Run 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 – the sql statement to be executed (str) or a list of sql statements to execute
autocommit – What to set the connection’s autocommit setting to before executing the query.
parameters – The parameters to render the SQL query with.
handler – The result handler which is called with the result of each statement.
split_statements – Whether to split a single SQL string into statements and run separately
return_last – 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.
- set_autocommit(conn, autocommit)[source]¶
Set 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.
- Parameters
conn – Connection to get autocommit setting from.
- Returns
connection autocommit setting. True if
autocommit
is set to True on the connection. False if it is either not set, set to False, or the connection does not support auto-commit.- Return type