You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/06/02 21:08:47 UTC

[airflow] branch main updated: AIP-47 | Migrate Trino example DAGs to new design (#24118)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7489962e75 AIP-47 | Migrate Trino example DAGs to new design (#24118)
7489962e75 is described below

commit 7489962e75a23071620a30c1e070fb7c9e107179
Author: chethanuk-plutoflume <ch...@outlook.com>
AuthorDate: Thu Jun 2 22:08:34 2022 +0100

    AIP-47 | Migrate Trino example DAGs to new design (#24118)
---
 airflow/providers/trino/example_dags/__init__.py        | 17 -----------------
 .../operators/transfer/gcs_to_trino.rst                 |  2 +-
 .../system/providers/trino}/example_gcs_to_trino.py     | 10 +++++++++-
 3 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/airflow/providers/trino/example_dags/__init__.py b/airflow/providers/trino/example_dags/__init__.py
deleted file mode 100644
index 217e5db960..0000000000
--- a/airflow/providers/trino/example_dags/__init__.py
+++ /dev/null
@@ -1,17 +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-trino/operators/transfer/gcs_to_trino.rst b/docs/apache-airflow-providers-trino/operators/transfer/gcs_to_trino.rst
index 46ded423b1..fa43780725 100644
--- a/docs/apache-airflow-providers-trino/operators/transfer/gcs_to_trino.rst
+++ b/docs/apache-airflow-providers-trino/operators/transfer/gcs_to_trino.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/trino/example_dags/example_gcs_to_trino.py
+.. exampleinclude:: /../../tests/system/providers/trino/example_gcs_to_trino.py
     :language: python
     :dedent: 4
     :start-after: [START gcs_csv_to_trino_table]
diff --git a/airflow/providers/trino/example_dags/example_gcs_to_trino.py b/tests/system/providers/trino/example_gcs_to_trino.py
similarity index 85%
rename from airflow/providers/trino/example_dags/example_gcs_to_trino.py
rename to tests/system/providers/trino/example_gcs_to_trino.py
index 71ffc38e89..ae56f92691 100644
--- a/airflow/providers/trino/example_dags/example_gcs_to_trino.py
+++ b/tests/system/providers/trino/example_gcs_to_trino.py
@@ -28,9 +28,11 @@ from airflow.providers.trino.transfers.gcs_to_trino import GCSToTrinoOperator
 BUCKET = os.environ.get("GCP_GCS_BUCKET", "test28397yeo")
 PATH_TO_FILE = os.environ.get("GCP_PATH", "path/to/file")
 TRINO_TABLE = os.environ.get("TRINO_TABLE", "test_table")
+ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
+DAG_ID = "example_gcs_to_trino"
 
 with models.DAG(
-    dag_id="example_gcs_to_trino",
+    dag_id=DAG_ID,
     schedule_interval='@once',  # Override to match your needs
     start_date=datetime(2022, 1, 1),
     catchup=False,
@@ -44,3 +46,9 @@ with models.DAG(
         trino_table=TRINO_TABLE,
     )
     # [END gcs_csv_to_trino_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)