te-horie opened a new pull request, #69846:
URL: https://github.com/apache/airflow/pull/69846

    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   # Summary
   
   This PR makes the `database` argument **optional** in `AthenaOperator`, 
allowing queries that do not require a default database.
   This is useful when all referenced table names are fully qualified, such as 
in queries across multiple databases.
   
   When `database` is not provided, `Database` from `query_execution_context` 
is used as the fallback database for OpenLineage dataset extraction.
   
   
   # Testing
   
   - ✅ `breeze run pytest 
providers/amazon/tests/unit/amazon/aws/operators/test_athena.py` **passed** (16 
test cases).
   - ✅ `prek run --from-ref upstream/main` **passed**.
   - ✅ **Successfully** ran the system test against Amazon Athena
     1. Locally removed the `database` argument from the `read_table` task in 
[`example_athena.py`](https://github.com/apache/airflow/blob/main/providers/amazon/tests/system/amazon/aws/example_athena.py)
 like this:
         ```diff
         diff --git 
a/providers/amazon/tests/system/amazon/aws/example_athena.py 
b/providers/amazon/tests/system/amazon/aws/example_athena.py
         index 36a37a8e1c..3c72e9b309 100644
         --- a/providers/amazon/tests/system/amazon/aws/example_athena.py
         +++ b/providers/amazon/tests/system/amazon/aws/example_athena.py
         @@ -129,7 +129,6 @@ with DAG(
              read_table = AthenaOperator(
                  task_id="read_table",
                  query=query_read_table,
         -        database=athena_database,
                  output_location=f"s3://{s3_bucket}/",
              )
              # [END howto_operator_athena]
         ```
     2. Ran the system test with the following command; it **passed** ✅:
         ```bash
         $ SYSTEM_TESTS_ENV_ID=airflowtest$(date +%s) breeze run 
--forward-credentials env AWS_PROFILE=airflow-test pytest --system 
providers/amazon/tests/system/amazon/aws/example_athena.py
         ...
         providers/amazon/tests/system/amazon/aws/example_athena.py::test_run 
<- devel-common/src/tests_common/test_utils/system_tests.py PASSED [100%]
         
         ================================================= 1 passed, 1 warning 
in 56.41s ==================================================
         ```
     3. Confirmed that the query succeeded with only `Catalog` in 
`QueryExecutionContext`:
         ```bash
         $ aws athena get-query-execution --query-execution-id <<<REDACTED>>> 
--profile airflow-test
         QueryExecution:
           ...
           Query: SELECT * from 
airflowtest1784003174_default.airflowtest1784003174_test_table
           QueryExecutionContext:
             Catalog: awsdatacatalog
           QueryExecutionId: <<<REDACTED>>>
           ...
           Status:
             CompletionDateTime: '2026-07-14T13:27:19.237000+09:00'
             State: SUCCEEDED
             SubmissionDateTime: '2026-07-14T13:27:17.950000+09:00'
           SubstatementType: SELECT
           WorkGroup: primary
         ```
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes (please specify the tool below)
   
   Generated-by: OpenAI Codex (GPT-5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   Drafted-by: OpenAI Codex; reviewed by @te-horie before posting


-- 
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