o-nikolas commented on code in PR #48120: URL: https://github.com/apache/airflow/pull/48120#discussion_r2013003623
########## providers/amazon/tests/system/amazon/aws/example_exasol_to_s3.py: ########## @@ -0,0 +1,93 @@ +# +# 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 DAG to test Exasol connection and S3 upload in Apache Airflow. + +This DAG uses the ExasolToS3Operator to execute a simple SQL query on Exasol and +upload the result file to S3. It verifies that both the Exasol connection (`exasol_default`) +and S3 credential settings (`aws_default`) are working correctly. +""" +from __future__ import annotations + +from datetime import datetime + +from airflow.models.baseoperator import chain +from airflow import DAG +from airflow.providers.amazon.aws.operators.s3 import S3CreateBucketOperator, S3DeleteBucketOperator +from airflow.providers.amazon.aws.transfers.exasol_to_s3 import ExasolToS3Operator +from airflow.utils.trigger_rule import TriggerRule +from system.amazon.aws.utils import SystemTestContextBuilder + +sys_test_context_task = SystemTestContextBuilder().build() + +DAG_ID = "example_exasol_to_s3" + +with DAG( + dag_id=DAG_ID, + start_date=datetime(2025, 3, 11), + schedule="@once", + catchup=False, + tags=["exasol", "s3", "test"], +) as dag: + + test_context = sys_test_context_task() + env_id = test_context["ENV_ID"] + s3_bucket_name = f"{env_id}-bucket" + s3_key = f"{env_id}/files/exasol-output.csv" + + create_s3_bucket = S3CreateBucketOperator( + task_id="create_s3_bucket", + bucket_name=s3_bucket_name, + ) + + # [START howto_transfer_exasol_to_s3] + exasol_to_s3 = ExasolToS3Operator( Review Comment: > In the amazon provider package there are system tests that integrate with Google as well and we assume the user has credentials to interact with Google. @vincbeck We just have one google related test right? The Youtube one, and there we do not assume the user has created a connection, we create one explicitly as part of the test: https://github.com/apache/airflow/blob/main/providers/amazon/tests/system/amazon/aws/example_google_api_youtube_to_s3.py#L81-L97 We do this in other tests that require special connections too (like redshift). As far as I know we do not currently have an example of just expecting a non-aws connection to exist, do you know of one? -- 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]
