You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "eladkal (via GitHub)" <gi...@apache.org> on 2024/02/02 09:01:06 UTC
Re: [PR] Add Qdrant Provider [airflow]
eladkal commented on code in PR #36805:
URL: https://github.com/apache/airflow/pull/36805#discussion_r1475758927
##########
airflow/providers/qdrant/hooks/qdrant.py:
##########
@@ -0,0 +1,128 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+from functools import cached_property
+from typing import Any
+
+from grpc import RpcError
+from qdrant_client import QdrantClient
+from qdrant_client.http.exceptions import UnexpectedResponse
+
+from airflow.hooks.base import BaseHook
+
+
+class QdrantHook(BaseHook):
+ """
+ Hook for interfacing with a Qdrant instance.
+
+ :param conn_id: The connection id to use when connecting to Qdrant. Defaults to `qdrant_default`.
+ """
+
+ conn_name_attr = "conn_id"
+ conn_type = "qdrant"
+ default_conn_name = "qdrant_default"
+ hook_name = "Qdrant"
+
+ @classmethod
+ def get_connection_form_widgets(cls) -> dict[str, Any]:
+ """Returns connection widgets to add to connection form."""
+ from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
+ from flask_babel import lazy_gettext
+ from wtforms import BooleanField, IntegerField, StringField
+
+ return {
+ "url": StringField(
+ lazy_gettext("URL"),
+ widget=BS3TextFieldWidget(),
+ description="Optional. Qualified URL of the Qdrant instance."
+ "Example: https://xyz-example.eu-central.aws.cloud.qdrant.io:6333",
+ ),
+ "grpc_port": IntegerField(
+ lazy_gettext("GPRC Port"),
+ widget=BS3TextFieldWidget(),
+ description="Optional. Port of the gRPC interface.",
+ default=6334,
+ ),
+ "prefer_gprc": BooleanField(
+ lazy_gettext("Prefer GRPC"),
+ widget=BS3TextFieldWidget(),
+ description="Optional. Whether to use gPRC interface whenever possible in custom methods.",
+ default=False,
+ ),
+ "https": BooleanField(
+ lazy_gettext("HTTPS"),
+ widget=BS3TextFieldWidget(),
+ description="Optional. Whether to use HTTPS(SSL) protocol.",
+ ),
+ "prefix": StringField(
+ lazy_gettext("Prefix"),
+ widget=BS3TextFieldWidget(),
+ description="Optional. Prefix to the REST URL path."
+ "Example: `service/v1` will result in http://localhost:6333/service/v1/{qdrant-endpoint} for REST API.",
+ ),
+ }
+
+ @classmethod
+ def get_ui_field_behaviour(cls) -> dict[str, Any]:
+ """Returns custom field behaviour."""
+ return {
+ "hidden_fields": ["schema", "login", "extra"],
+ "relabeling": {"password": "API Key"},
Review Comment:
just to clarify - this field is also masked when value is shown in the UI?
##########
airflow/providers/qdrant/CHANGELOG.rst:
##########
@@ -0,0 +1,26 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-qdrant``
+
+Changelog
+---------
+
+1.0.0
+.....
+
+Initial version of the provider.
Review Comment:
```suggestion
* ``Initial version of the provider. (#36805)``
```
This will just help to populate this PR to the github issue status when we cut release
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org