airflow.providers.vertica.hooks.vertica

Module Contents

Classes

VerticaHook

Interact with Vertica.

Functions

vertica_fetch_all_handler(cursor)

Replace the default DbApiHook fetch_all_handler in order to fix this issue https://github.com/apache/airflow/issues/32993.

airflow.providers.vertica.hooks.vertica.vertica_fetch_all_handler(cursor)[source]

Replace the default DbApiHook fetch_all_handler in order to fix this issue https://github.com/apache/airflow/issues/32993.

Returned value will not change after the initial call of fetch_all_handler, all the remaining code is here only to make vertica client throws error. With Vertica, if you run the following sql (with split_statements set to false):

INSERT INTO MyTable (Key, Label) values (1, ‘test 1’); INSERT INTO MyTable (Key, Label) values (1, ‘test 2’); INSERT INTO MyTable (Key, Label) values (3, ‘test 3’);

each insert will have its own result set and if you don’t try to fetch data of those result sets you won’t detect error on the second insert.

class airflow.providers.vertica.hooks.vertica.VerticaHook(*args, schema=None, log_sql=True, **kwargs)[source]

Bases: airflow.providers.common.sql.hooks.sql.DbApiHook

Interact with Vertica.

This hook use a customized version of default fetch_all_handler named vertica_fetch_all_handler.

conn_name_attr = 'vertica_conn_id'[source]
default_conn_name = 'vertica_default'[source]
conn_type = 'vertica'[source]
hook_name = 'Vertica'[source]
supports_autocommit = True[source]
get_conn()[source]

Return vertica connection object.

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], Any] = ..., split_statements: bool = ..., return_last: bool = ...) Any | list[Any]

Overwrite the common sql run.

Will automatically replace fetch_all_handler by vertica_fetch_all_handler.

Was this entry helpful?