shahar1 commented on code in PR #69526:
URL: https://github.com/apache/airflow/pull/69526#discussion_r3554145774
##########
providers/common/sql/src/airflow/providers/common/sql/hooks/sql.py:
##########
@@ -334,7 +335,20 @@ def get_sqlalchemy_engine(self, engine_kwargs=None) ->
Engine:
self.log.debug("url: %s", url)
self.log.debug("engine_kwargs: %s", engine_kwargs)
- return create_engine(url=url, **engine_kwargs)
+ try:
+ return create_engine(url=url, **engine_kwargs)
+ except (ImportError, ModuleNotFoundError):
Review Comment:
Why don't we have the `_is_sqlaclhemy_2()` check here?
##########
providers/postgres/docs/changelog.rst:
##########
@@ -44,6 +44,17 @@ Breaking changes
``apache-airflow-providers-postgres[asyncpg]`` and set
``[database] sql_alchemy_conn_async = postgresql+asyncpg://...``
explicitly.
+.. note::
+ The default synchronous metadata-database driver is now ``psycopg``
(psycopg3), mirroring the
+ async default above. ``psycopg2-binary`` is no longer installed by
default; it moved from a hard
+ dependency to the new ``[psycopg2]`` optional extra.
Review Comment:
I'm worried because of Airflow 2.11 comatibility (AFAIK we should still
support that in the providers) - once we make this an optional extra, Airflow
2.11 users will encounter `AirflowOptionalProviderFeatureException ` without
warning. Maybe it should be clarified.
##########
providers/pgvector/src/airflow/providers/pgvector/operators/pgvector.py:
##########
@@ -41,6 +40,24 @@ def __init__(self, *args, **kwargs) -> None:
def _register_vector(self) -> None:
"""Register the vector type with your connection."""
+ from airflow.providers.postgres.hooks.postgres import USE_PSYCOPG3
+
+ if USE_PSYCOPG3:
+ try:
+ from pgvector.psycopg import register_vector
+ except (ImportError, ModuleNotFoundError) as err:
+ raise AirflowOptionalProviderFeatureException(
+ "pgvector's psycopg (v3) integration is not installed.
Please install it with "
+ "`pip install pgvector`."
+ ) from err
Review Comment:
nit:
```suggestion
raise AirflowOptionalProviderFeatureException(
"pgvector's psycopg (v3) integration is not installed.
Please install it with "
"`pip install --upgrade pgvector`."
) from err
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]