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 21e6a49db5 resolving conflicts (#39728)
21e6a49db5 is described below
commit 21e6a49db57cb99601bf0ea8c9d2c8980f474614
Author: Bowrna <[email protected]>
AuthorDate: Sat Jun 1 16:29:40 2024 +0530
resolving conflicts (#39728)
---
.../operators/trino.rst | 11 +++++++----
tests/always/test_example_dags.py | 3 ---
tests/system/providers/trino/example_trino.py | 19 ++++++++-----------
3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/docs/apache-airflow-providers-trino/operators/trino.rst
b/docs/apache-airflow-providers-trino/operators/trino.rst
index 8b8d796efd..d0e901ebed 100644
--- a/docs/apache-airflow-providers-trino/operators/trino.rst
+++ b/docs/apache-airflow-providers-trino/operators/trino.rst
@@ -17,19 +17,22 @@
.. _howto/operator:TrinoOperator:
-TrinoOperator
-=============
+Connect to Trino using SQLExecuteQueryOperator
+==============================================
-Use the :class:`TrinoOperator <airflow.providers.trino.operators.trino>` to
execute
+Use the :class:`SQLExecuteQueryOperator
<airflow.providers.common.sql.operators.sql>` to execute
SQL commands in a `Trino <https://trino.io/>`__ query engine.
+.. warning::
+ TrinoOperator is deprecated in favor of SQLExecuteQueryOperator. If you are
using TrinoOperator you should migrate as soon as possible.
+
Using the Operator
^^^^^^^^^^^^^^^^^^
Use the ``trino_conn_id`` argument to connect to your Trino instance
-An example usage of the TrinoOperator is as follows:
+An example usage of the SQLExecuteQueryOperator to connect to Trino is as
follows:
.. exampleinclude:: /../../tests/system/providers/trino/example_trino.py
:language: python
diff --git a/tests/always/test_example_dags.py
b/tests/always/test_example_dags.py
index 24c00f909d..8a483ed452 100644
--- a/tests/always/test_example_dags.py
+++ b/tests/always/test_example_dags.py
@@ -58,9 +58,6 @@ IGNORE_AIRFLOW_PROVIDER_DEPRECATION_WARNING: tuple[str, ...]
= (
"tests/system/providers/google/cloud/life_sciences/example_life_sciences.py",
"tests/system/providers/google/marketing_platform/example_analytics.py",
# Deprecated Operators/Hooks, which replaced by common.sql Operators/Hooks
- "tests/system/providers/jdbc/example_jdbc_queries.py",
- "tests/system/providers/snowflake/example_snowflake.py",
- "tests/system/providers/trino/example_trino.py",
)
diff --git a/tests/system/providers/trino/example_trino.py
b/tests/system/providers/trino/example_trino.py
index 2174c0f47b..91e1c9dfce 100644
--- a/tests/system/providers/trino/example_trino.py
+++ b/tests/system/providers/trino/example_trino.py
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
"""
-Example DAG using TrinoOperator.
+Example DAG using SQLExecuteQueryOperator to connect to Trino.
"""
from __future__ import annotations
@@ -24,7 +24,7 @@ from __future__ import annotations
from datetime import datetime
from airflow import models
-from airflow.providers.trino.operators.trino import TrinoOperator
+from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
SCHEMA = "hive.cities"
TABLE = "city"
@@ -40,12 +40,12 @@ with models.DAG(
catchup=False,
tags=["example"],
) as dag:
- trino_create_schema = TrinoOperator(
+ trino_create_schema = SQLExecuteQueryOperator(
task_id="trino_create_schema",
sql=f"CREATE SCHEMA IF NOT EXISTS {SCHEMA} WITH (location =
's3://irisbkt/cities/');",
handler=list,
)
- trino_create_table = TrinoOperator(
+ trino_create_table = SQLExecuteQueryOperator(
task_id="trino_create_table",
sql=f"""CREATE TABLE IF NOT EXISTS {SCHEMA}.{TABLE}(
cityid bigint,
@@ -53,14 +53,12 @@ with models.DAG(
)""",
handler=list,
)
-
- trino_insert = TrinoOperator(
+ trino_insert = SQLExecuteQueryOperator(
task_id="trino_insert",
sql=f"""INSERT INTO {SCHEMA}.{TABLE} VALUES (1, 'San Francisco');""",
handler=list,
)
-
- trino_multiple_queries = TrinoOperator(
+ trino_multiple_queries = SQLExecuteQueryOperator(
task_id="trino_multiple_queries",
sql=f"""CREATE TABLE IF NOT EXISTS {SCHEMA}.{TABLE1}(cityid
bigint,cityname varchar);
INSERT INTO {SCHEMA}.{TABLE1} VALUES (2, 'San Jose');
@@ -68,14 +66,13 @@ with models.DAG(
INSERT INTO {SCHEMA}.{TABLE2} VALUES (3, 'San Diego');""",
handler=list,
)
-
- trino_templated_query = TrinoOperator(
+ trino_templated_query = SQLExecuteQueryOperator(
task_id="trino_templated_query",
sql="SELECT * FROM {{ params.SCHEMA }}.{{ params.TABLE }}",
handler=list,
params={"SCHEMA": SCHEMA, "TABLE": TABLE1},
)
- trino_parameterized_query = TrinoOperator(
+ trino_parameterized_query = SQLExecuteQueryOperator(
task_id="trino_parameterized_query",
sql=f"select * from {SCHEMA}.{TABLE2} where cityname = ?",
parameters=("San Diego",),