josh-fell commented on code in PR #36805: URL: https://github.com/apache/airflow/pull/36805#discussion_r1470517045
########## pyproject.toml: ########## @@ -533,6 +533,7 @@ alibaba = [ "oss2>=2.14.0", ] amazon = [ + "PyAthena>=3.0.10", Review Comment: Is this a related change? ########## 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 { Review Comment: Great use of `description`s in the form! ########## docs/apache-airflow-providers-qdrant/index.rst: ########## @@ -0,0 +1,98 @@ + + .. 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`` +====================================== + + +.. toctree:: + :hidden: + :maxdepth: 1 + :caption: Basics + + Home <self> + Changelog <changelog> + Security <security> + +.. toctree:: + :hidden: + :maxdepth: 1 + :caption: Guides + + Connection types <connections> + Operators <operators/qdrant> + + +.. toctree:: + :hidden: + :maxdepth: 1 + :caption: Commits + + Detailed list of commits <commits> + + +.. toctree:: + :hidden: + :maxdepth: 1 + :caption: Resources + + Python API <_api/airflow/providers/qdrant/index> + PyPI Repository <https://pypi.org/project/apache-airflow-providers-qdrant/> + Installing from sources <installing-providers-from-sources> + +.. toctree:: + :hidden: + :maxdepth: 1 + :caption: System tests + + System Tests <_api/tests/system/providers/qdrant/index> + +Package apache-airflow-providers-qdrant +----------------------------------------- + +`Qdrant <https://qdrant.tech/>`__ + + +Release: 1.0.0 + +Provider package +---------------- + +This is a provider package for ``Qdrant`` APIs. All classes for this provider package +are in ``airflow.providers.qdrant`` python module. + +Installation +------------ + +You can install this package on top of an existing Airflow 2 installation (see ``Requirements`` below) +for the minimum Airflow version supported) via +``pip install apache-airflow-providers-qdrant`` + + +Requirements +------------ + +The minimum Apache Airflow version supported by this provider package is ``2.5.0``. + + +=================== ================== +PIP package Version required +=================== ================== +``apache-airflow`` ``>=2.5.0`` Review Comment: ```suggestion ``apache-airflow`` ``>=2.6.0`` ``` ########## tests/system/providers/qdrant/example_dag_qdrant.py: ########## @@ -0,0 +1,49 @@ +# 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 datetime import datetime + +from airflow import DAG +from airflow.providers.qdrant.operators.qdrant import QdrantIngestOperator + +with DAG( + "example_qdrant_ingest", + schedule=None, + start_date=datetime(2024, 1, 1), + catchup=True, Review Comment: ```suggestion catchup=False, ``` Typically we make sure the examples have `catchup=False` just in case users (especially those new to Airflow) change the `schedule` or `start_date`. This way they aren't surprised by spawning DAG runs. Unless this is a deliberate decision (albeit the default)? ########## tests/providers/qdrant/operators/test_qdrant.py: ########## @@ -0,0 +1,70 @@ +# 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 datetime import datetime +from unittest.mock import patch + +import pytest + +from airflow.models import DAG +from airflow.providers.qdrant.operators.qdrant import QdrantIngestOperator + + +@pytest.fixture +def dummy_dag(): Review Comment: You could use the available [`dag_maker` fixture](https://github.com/apache/airflow/blob/8914e49551d8ae5ece7418950b011c1f338b4634/tests/conftest.py#L611) here if you'd like. -- 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