o-nikolas commented on code in PR #48120: URL: https://github.com/apache/airflow/pull/48120#discussion_r2010580704
########## 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: Fair enough, I think the AWS credentials make sense because these are AWS system tests. So it is safe to assume you at least need credentials setup for an AWS account otherwise every single test will fail. I also don't know of another test that we have that works like this (silently assuming you setup credentials/connection), so this would be kind of setting a precedent. I'm okay to start moving this way if others also like it, but it's certainly less explicit and could leave a lot of people scratching their heads. If we want to keep it like this maybe we at least put a comment here explaining that this task will not work as provided and then link to the new (and very nice! :smile:) documentation on how to setup the Exasol connection? -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org