Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pyathena/result_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class AthenaResultSet(CursorIterator):
# https://docs.aws.amazon.com/athena/latest/ug/data-types.html
# Athena complex types that benefit from type hint conversion.
_COMPLEX_TYPES: frozenset[str] = frozenset({"array", "map", "row", "struct"})
_DML_SUBSTATEMENT_TYPES: frozenset[str] = frozenset({"INSERT", "UPDATE", "DELETE", "MERGE"})

def __init__(
self,
Expand Down Expand Up @@ -318,7 +319,10 @@ def result_reuse_minutes(self) -> int | None:
def description(
self,
) -> list[tuple[str, str, None, None, int, int, str]] | None:
if self._metadata is None:
if self._metadata is None or (
self.substatement_type
and self.substatement_type.upper() in self._DML_SUBSTATEMENT_TYPES
):
return None
return [
(
Expand Down
4 changes: 4 additions & 0 deletions tests/pyathena/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ def test_iceberg_table(self, cursor):
VALUES (1, 'test1'), (2, 'test2')
"""
)
assert cursor.description is None
assert cursor.rowcount == 2
cursor.execute(
f"""
Expand All @@ -842,6 +843,7 @@ def test_iceberg_table(self, cursor):
WHERE id = 1
"""
)
assert cursor.description is None
assert cursor.rowcount == 1
cursor.execute(
f"""
Expand Down Expand Up @@ -873,6 +875,7 @@ def test_iceberg_table(self, cursor):
THEN UPDATE SET col1 = t2.col1
"""
)
assert cursor.description is None
assert cursor.rowcount == 1
cursor.execute(
f"""
Expand All @@ -895,6 +898,7 @@ def test_iceberg_table(self, cursor):
WHERE id = 2
"""
)
assert cursor.description is None
assert cursor.rowcount == 1
cursor.execute(
f"""
Expand Down
1 change: 0 additions & 1 deletion tests/sqlalchemy/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
del LongNameBlowoutTest # noqa: F821
del QuotedNameArgumentTest # noqa: F821
del RowCountTest # noqa: F821
del SimpleUpdateDeleteTest # noqa: F821
del TimeMicrosecondsTest # noqa: F821
del TimeTest # noqa: F821
del TimestampMicrosecondsTest # noqa: F821
Expand Down