This is an automated email from the ASF dual-hosted git repository.

amoghdesai 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 26dbca59471 Replace usage of 'set_extra' with 'extra' for athena sql 
hook (#52340)
26dbca59471 is described below

commit 26dbca594716d4754daa97e7648eb6bdca1b04c3
Author: Amogh Desai <[email protected]>
AuthorDate: Fri Jun 27 19:37:26 2025 +0530

    Replace usage of 'set_extra' with 'extra' for athena sql hook (#52340)
---
 .../amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/providers/amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py 
b/providers/amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py
index e8d8680c29c..d66f788226a 100644
--- a/providers/amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py
+++ b/providers/amazon/src/airflow/providers/amazon/aws/hooks/athena_sql.py
@@ -111,7 +111,14 @@ class AthenaSQLHook(AwsBaseHook, DbApiHook):
                 connection.login = athena_conn.login
                 connection.password = athena_conn.password
                 connection.schema = athena_conn.schema
-                connection.set_extra(json.dumps({**athena_conn.extra_dejson, 
**connection.extra_dejson}))
+                merged_extra = {**athena_conn.extra_dejson, 
**connection.extra_dejson}
+                try:
+                    extra_json = json.dumps(merged_extra)
+                    connection.extra = extra_json
+                except (TypeError, ValueError):
+                    raise ValueError(
+                        f"Encountered non-JSON in `extra` field for connection 
{self.aws_conn_id!r}."
+                    )
             except AirflowNotFoundException:
                 connection = athena_conn
                 connection.conn_type = "aws"

Reply via email to