utkarsharma2 commented on code in PR #36085:
URL: https://github.com/apache/airflow/pull/36085#discussion_r1418799391


##########
airflow/providers/weaviate/operators/weaviate.py:
##########
@@ -51,21 +57,38 @@ def __init__(
         self,
         conn_id: str,
         class_name: str,
-        input_json: list[dict[str, Any]],
+        input_json: list[dict[str, Any]] | pd.DataFrame | None = None,
+        input_data: list[dict[str, Any]] | pd.DataFrame | None = None,
+        vector_col: str = "Vector",
         **kwargs: Any,
     ) -> None:
         self.batch_params = kwargs.pop("batch_params", {})
         self.hook_params = kwargs.pop("hook_params", {})
         super().__init__(**kwargs)
         self.class_name = class_name
         self.conn_id = conn_id
-        self.input_json = input_json
+        self.vector_col = vector_col
+        self.input_data = input_data
+        if input_json:
+            warnings.warn(
+                "Passing 'input_json' to WeaviateIngestOperator is deprecated 
and"
+                " you should use 'input_data' instead",
+                AirflowProviderDeprecationWarning,
+            )
+            self.input_data = input_json
+        if self.input_data is None:
+            raise ValueError("Either input_json or input_data is required")
 
     @cached_property
     def hook(self) -> WeaviateHook:
         """Return an instance of the WeaviateHook."""
         return WeaviateHook(conn_id=self.conn_id, **self.hook_params)
 
     def execute(self, context: Context) -> None:
-        self.log.debug("Input json: %s", self.input_json)
-        self.hook.batch_data(self.class_name, self.input_json, 
**self.batch_params)
+        self.log.debug("Input data: %s", self.input_data)
+        self.hook.batch_data(
+            self.class_name,
+            self.input_data,  # type: ignore

Review Comment:
   That's a clever solution, thanks! :)
   
   Also, you changed the exception to `TypeError` from `ValueError`, was there 
any reason for that? To my understanding, we should raise a `ValueError` right? 



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to