diff --git a/airflow/providers/presto/example_dags/__init__.py b/airflow/providers/presto/example_dags/__init__.py deleted file mode 100644 index 13a83393a9124..0000000000000 --- a/airflow/providers/presto/example_dags/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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. diff --git a/docs/apache-airflow-providers-presto/index.rst b/docs/apache-airflow-providers-presto/index.rst index 9458123abd823..9fbd1b9347728 100644 --- a/docs/apache-airflow-providers-presto/index.rst +++ b/docs/apache-airflow-providers-presto/index.rst @@ -38,7 +38,7 @@ Content :maxdepth: 1 :caption: Resources - Example DAGs + Example DAGs PyPI Repository Installing from sources diff --git a/docs/apache-airflow-providers-presto/operators/transfer/gcs_to_presto.rst b/docs/apache-airflow-providers-presto/operators/transfer/gcs_to_presto.rst index 7e7206cec2d2f..371b7d4141679 100644 --- a/docs/apache-airflow-providers-presto/operators/transfer/gcs_to_presto.rst +++ b/docs/apache-airflow-providers-presto/operators/transfer/gcs_to_presto.rst @@ -45,7 +45,7 @@ This operator assumes that CSV does not have headers and the data is correspondi pre-existing presto table. Optionally, you can provide schema as tuple/list of strings or as a path to a JSON file in the same bucket as the CSV file. -.. exampleinclude:: /../../airflow/providers/presto/example_dags/example_gcs_to_presto.py +.. exampleinclude:: /../../tests/system/providers/presto/example_gcs_to_presto.py :language: python :dedent: 4 :start-after: [START gcs_csv_to_presto_table] diff --git a/airflow/providers/presto/example_dags/example_gcs_to_presto.py b/tests/system/providers/presto/example_gcs_to_presto.py similarity index 85% rename from airflow/providers/presto/example_dags/example_gcs_to_presto.py rename to tests/system/providers/presto/example_gcs_to_presto.py index 1593127869144..7c062e2d72536 100644 --- a/airflow/providers/presto/example_dags/example_gcs_to_presto.py +++ b/tests/system/providers/presto/example_gcs_to_presto.py @@ -28,9 +28,11 @@ BUCKET = os.environ.get("GCP_GCS_BUCKET", "test28397yeo") PATH_TO_FILE = os.environ.get("GCP_PATH", "path/to/file") PRESTO_TABLE = os.environ.get("PRESTO_TABLE", "test_table") +ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID") +DAG_ID = "example_gcs_to_presto" with models.DAG( - dag_id="example_gcs_to_presto", + dag_id=DAG_ID, schedule_interval='@once', # Override to match your needs start_date=datetime(2022, 1, 1), catchup=False, @@ -44,3 +46,9 @@ presto_table=PRESTO_TABLE, ) # [END gcs_csv_to_presto_table] + + +from tests.system.utils import get_test_run # noqa: E402 + +# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) +test_run = get_test_run(dag)