Taragolis commented on code in PR #34891:
URL: https://github.com/apache/airflow/pull/34891#discussion_r1364142683
##########
airflow/providers/postgres/operators/postgres.py:
##########
@@ -80,3 +86,60 @@ def __init__(
AirflowProviderDeprecationWarning,
stacklevel=2,
)
+
+
+class PgVectorIngestOperator(BaseOperator):
+ """
+ Operator for ingesting text and embeddings into a PostgreSQL database
using the pgvector library.
+
+ :param conn_id: The connection ID for the postgresql database.
+ :param input_data: Tuple containing the string input content and
corresponding list of float vector
+ embeddings.
+ :param input_callable: A callable that returns a tuple containing the
string input content and
+ corresponding list of float vector embeddings, if ``input_data`` is
not provided.
+ :param input_callable_args: Positional arguments for the 'input_callable'.
+ :param input_callable_kwargs: Keyword arguments for the 'input_callable'.
+ :param kwargs: Additional keyword arguments for the BaseOperator.
+ """
+
+ def __init__(
+ self,
+ conn_id: str,
+ input_data: tuple[str, list[float]] | None = None,
+ input_callable: Callable[[Any], Any] | None = None,
+ input_callable_args: Collection[Any] | None = None,
+ input_callable_kwargs: Mapping[str, Any] | None = None,
Review Comment:
> (2) with a callable
That is exactly what a PythonOperator (and taskflow decorators) does as well
as provide greater flexibility, e.g. access to task context.
In the other hand current implementation it is a combination of (1) classic
operator and (2) restricted PythonOperator. The second part could be replaced
by add examples in docs how to use Hook within the taskflow.
It would reduce complexibility of the code and number of required tests
--
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]