Skip to content

Commit 45ab10b

Browse files
Fix Athena SQL syntax in ARRAY type tests
- Replace invalid object literal syntax {name: 'value'} with proper ROW casting - Break long SQL queries into multiple lines for readability - Update converter test expectations to match Athena native format - Ensure all tests use valid Athena SQL syntax for CI compatibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 42fd51b commit 45ab10b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/pyathena/test_cursor.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -999,8 +999,8 @@ def test_array_types_basic(self, cursor, query, description):
999999
"unnamed_struct_array",
10001000
),
10011001
(
1002-
"SELECT ARRAY[{name: 'John', age: 25}, {name: 'Jane', age: 30}] "
1003-
"AS named_struct_array",
1002+
"SELECT ARRAY[CAST(ROW('John', 25) AS ROW(name VARCHAR, age INT)), "
1003+
"CAST(ROW('Jane', 30) AS ROW(name VARCHAR, age INT))] AS named_struct_array",
10041004
"named_struct_array",
10051005
),
10061006
],
@@ -1105,7 +1105,10 @@ def test_array_converter_behavior(self, cursor):
11051105
assert simple_array == [1, 2, 3]
11061106

11071107
# Test array with struct conversion
1108-
cursor.execute("SELECT ARRAY[{a: 1, b: 2}, {a: 3, b: 4}] AS struct_array")
1108+
cursor.execute(
1109+
"SELECT ARRAY[CAST(ROW(1, 2) AS ROW(a INT, b INT)), "
1110+
"CAST(ROW(3, 4) AS ROW(a INT, b INT))] AS struct_array"
1111+
)
11091112
result = cursor.fetchone()
11101113
struct_array = result[0]
11111114
_logger.info(f"Struct array: {struct_array!r}")
@@ -1117,7 +1120,7 @@ def test_array_converter_behavior(self, cursor):
11171120
test_cases = [
11181121
("[1, 2, 3]", [1, 2, 3]),
11191122
('["a", "b", "c"]', ["a", "b", "c"]),
1120-
("[{a: 1, b: 2}]", [{"a": 1, "b": 2}]),
1123+
("[{a=1, b=2}]", [{"a": 1, "b": 2}]),
11211124
("[]", []),
11221125
(None, None),
11231126
("invalid", None),

0 commit comments

Comments
 (0)