Skip to content

Commit c5d5343

Browse files
Check for pair of brackets in query preparation for Athena cache (#1529)
Co-authored-by: jaidisido <[email protected]>
1 parent 1b109c1 commit c5d5343

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

awswrangler/athena/_cache.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ def _prepare_query_string_for_comparison(query_string: str) -> str:
116116
"""To use cached data, we need to compare queries. Returns a query string in canonical form."""
117117
# for now this is a simple complete strip, but it could grow into much more sophisticated
118118
# query comparison data structures
119-
query_string = "".join(query_string.split()).strip("()").lower()
119+
query_string = "".join(query_string.split()).strip().lower()
120+
while query_string.startswith("(") and query_string.endswith(")"):
121+
query_string = query_string[1:-1]
120122
query_string = query_string[:-1] if query_string.endswith(";") else query_string
121123
return query_string
122124

0 commit comments

Comments
 (0)