SatishChGit commented on code in PR #39217:
URL: https://github.com/apache/airflow/pull/39217#discussion_r1589544189


##########
tests/system/providers/teradata/example_azure_blob_to_teradata_transfer.py:
##########
@@ -0,0 +1,163 @@
+#
+# 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.
+"""
+Example Airflow DAG to show usage of AzureBlobStorageToTeradataOperator
+
+The transfer operator moves files in CSV, JSON, and PARQUET formats from Azure 
Blob storage
+to Teradata tables. In the example Directed Acyclic Graph (DAG) below, it 
assumes Airflow
+Connections with the IDs `teradata_default` and `wasb_default` already exist. 
The DAG creates
+tables using data from the Azure Blob location, reports the number of rows 
inserted into
+the table, and subsequently drops the table.
+"""
+
+from __future__ import annotations
+
+import datetime
+import os
+
+import pytest
+
+from airflow import DAG
+
+try:
+    from airflow.providers.teradata.operators.teradata import TeradataOperator
+    from airflow.providers.teradata.transfers.azure_blob_to_teradata import 
AzureBlobStorageToTeradataOperator
+except ImportError:
+    pytest.skip("Teradata provider apache-airflow-provider-teradata not 
available", allow_module_level=True)
+
+# [START azure_blob_to_teradata_transfer_operator_howto_guide]
+
+ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
+DAG_ID = "example_azure_blob_to_teradata_transfer_operator"
+CONN_ID = "teradata_default"
+
+with DAG(
+    dag_id=DAG_ID,
+    start_date=datetime.datetime(2020, 2, 2),
+    schedule="@once",
+    catchup=False,
+    default_args={"conn_id": "teradata_default"},
+) as dag:
+    # [START 
azure_blob_to_teradata_transfer_operator_howto_guide_transfer_data_blob_to_teradata_csv]
+    transfer_data_csv = AzureBlobStorageToTeradataOperator(
+        task_id="transfer_data_blob_to_teradata_csv",
+        
blob_source_key="/az/akiaxox5jikeotfww4ul.blob.core.windows.net/td-usgs/CSVDATA/09380000/2018/06/",
+        teradata_table="example_blob_teradata_csv",
+        azure_conn_id="wasb_default",
+        teradata_conn_id="teradata_default",
+        trigger_rule="all_done",
+    )
+    # [END 
azure_blob_to_teradata_transfer_operator_howto_guide_transfer_data_blob_to_teradata_csv]
+    # [START 
azure_blob_to_teradata_transfer_operator_howto_guide_read_data_table_csv]
+    read_data_table_csv = TeradataOperator(
+        task_id="read_data_table_csv",
+        conn_id=CONN_ID,
+        sql="""
+                SELECT count(1) from example_blob_teradata_csv;
+            """,

Review Comment:
   Addressed suggestion in all applicable places.



##########
tests/system/providers/teradata/example_azure_blob_to_teradata_transfer.py:
##########
@@ -0,0 +1,163 @@
+#
+# 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.
+"""
+Example Airflow DAG to show usage of AzureBlobStorageToTeradataOperator
+
+The transfer operator moves files in CSV, JSON, and PARQUET formats from Azure 
Blob storage
+to Teradata tables. In the example Directed Acyclic Graph (DAG) below, it 
assumes Airflow
+Connections with the IDs `teradata_default` and `wasb_default` already exist. 
The DAG creates
+tables using data from the Azure Blob location, reports the number of rows 
inserted into
+the table, and subsequently drops the table.
+"""
+
+from __future__ import annotations
+
+import datetime
+import os
+
+import pytest
+
+from airflow import DAG
+
+try:
+    from airflow.providers.teradata.operators.teradata import TeradataOperator
+    from airflow.providers.teradata.transfers.azure_blob_to_teradata import 
AzureBlobStorageToTeradataOperator
+except ImportError:
+    pytest.skip("Teradata provider apache-airflow-provider-teradata not 
available", allow_module_level=True)
+
+# [START azure_blob_to_teradata_transfer_operator_howto_guide]
+
+ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
+DAG_ID = "example_azure_blob_to_teradata_transfer_operator"
+CONN_ID = "teradata_default"
+
+with DAG(
+    dag_id=DAG_ID,
+    start_date=datetime.datetime(2020, 2, 2),
+    schedule="@once",
+    catchup=False,
+    default_args={"conn_id": "teradata_default"},
+) as dag:
+    # [START 
azure_blob_to_teradata_transfer_operator_howto_guide_transfer_data_blob_to_teradata_csv]
+    transfer_data_csv = AzureBlobStorageToTeradataOperator(
+        task_id="transfer_data_blob_to_teradata_csv",
+        
blob_source_key="/az/akiaxox5jikeotfww4ul.blob.core.windows.net/td-usgs/CSVDATA/09380000/2018/06/",
+        teradata_table="example_blob_teradata_csv",
+        azure_conn_id="wasb_default",
+        teradata_conn_id="teradata_default",
+        trigger_rule="all_done",
+    )
+    # [END 
azure_blob_to_teradata_transfer_operator_howto_guide_transfer_data_blob_to_teradata_csv]
+    # [START 
azure_blob_to_teradata_transfer_operator_howto_guide_read_data_table_csv]
+    read_data_table_csv = TeradataOperator(
+        task_id="read_data_table_csv",
+        conn_id=CONN_ID,
+        sql="""
+                SELECT count(1) from example_blob_teradata_csv;
+            """,
+    )
+    # [END 
azure_blob_to_teradata_transfer_operator_howto_guide_read_data_table_csv]
+    # [START 
azure_blob_to_teradata_transfer_operator_howto_guide_drop_table_csv]
+    drop_table_csv = TeradataOperator(
+        task_id="drop_table_csv",
+        conn_id=CONN_ID,
+        sql="""
+                DROP TABLE example_blob_teradata_csv;
+            """,

Review Comment:
   Addressed suggestion in all applicable places.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to