vincbeck commented on code in PR #77067:
URL: https://github.com/apache/airflow/pull/77067#discussion_r4602413155
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/athena.py:
##########
@@ -132,9 +132,10 @@ def run_query(
params = {
"QueryString": query,
"QueryExecutionContext": query_context,
- "ResultConfiguration": result_configuration,
"WorkGroup": workgroup,
}
+ if result_configuration:
Review Comment:
nit: now that an empty `result_configuration` is valid, maybe make the
parameter optional (`dict[str, Any] | None = None`), so callers on a
managed-results workgroup don't have to pass `{}`?
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/athena.py:
##########
@@ -343,7 +346,7 @@ def get_output_location(self, query_execution_id: str) ->
str:
raise ValueError(f"Unable to get query information for execution
id: {query_execution_id}")
try:
- return
response["QueryExecution"]["ResultConfiguration"]["OutputLocation"]
+ return response["QueryExecution"].get("ResultConfiguration",
{}).get("OutputLocation")
Review Comment:
Should we return `None` only when `ManagedQueryResultsConfiguration.Enabled`
is true, and keep raising otherwise? Today any response without
`ResultConfiguration` or `OutputLocation` silently returns `None`, and the
`KeyError` below only fires when `QueryExecution` is missing.
##########
providers/amazon/src/airflow/providers/amazon/aws/operators/athena.py:
##########
@@ -57,7 +57,8 @@ class AthenaOperator(AwsBaseOperator[AthenaHook]):
To run the query, you must specify the query results location using
one of the ways:
either for individual queries using either this setting (client-side),
or in the workgroup, using WorkGroupConfiguration.
- If none of them is set, Athena issues an error that no output location
is provided
+ If none of them is set, Athena issues an error that no output location
is provided.
+ Leave it unset for a workgroup with managed query results.
Review Comment:
nit: this contradicts "you must specify the query results location" a bit.
Maybe list managed query results as one of the ways above?
--
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]