airflow.providers.vertica.hooks.vertica¶
类¶
与 Vertica 交互。 |
函数¶
|
替换默认的 DbApiHook 的 fetch_all_handler,以解决此问题 https://github.com/apache/airflow/issues/32993。 |
模块内容¶
- airflow.providers.vertica.hooks.vertica.vertica_fetch_all_handler(cursor)[source]¶
替换默认的 DbApiHook 的 fetch_all_handler,以解决此问题 https://github.com/apache/airflow/issues/32993。
返回值在首次调用 fetch_all_handler 后不会改变,所有剩余代码仅用于让 vertica 客户端抛出错误。对于 Vertica,如果运行以下 sql(将 split_statements 设置为 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’);
每个插入操作都有自己的结果集,如果你不尝试获取这些结果集的数据,就不会检测到第二个插入操作中的错误。
- class airflow.providers.vertica.hooks.vertica.VerticaHook(*args, schema=None, log_sql=True, **kwargs)[source]¶
继承自:
airflow.providers.common.sql.hooks.sql.DbApiHook
与 Vertica 交互。
这个 hook 使用了名为 vertica_fetch_all_handler 的定制版默认 fetch_all_handler。
- run(sql: str | collections.abc.Iterable[str], autocommit: bool = ..., parameters: collections.abc.Iterable | collections.abc.Mapping[str, Any] | None = ..., handler: None = ..., split_statements: bool = ..., return_last: bool = ...) None [source]¶
- run(sql: str | collections.abc.Iterable[str], autocommit: bool = ..., parameters: collections.abc.Iterable | collections.abc.Mapping[str, Any] | None = ..., handler: Callable[[Any], Any] = ..., split_statements: bool = ..., return_last: bool = ...) Any | list[Any]
覆盖公共 sql 的 run 方法。
将自动使用 vertica_fetch_all_handler 替换 fetch_all_handler。