Skip to content

Commit f9a865c

Browse files
zeehioCaselIT
authored andcommitted
Fix table reflection on oracle <10.2
Fixed table reflection on Oracle 10.2 and older where compression options are not supported. Fixes: sqlalchemy#11557 Closes: sqlalchemy#11558 Pull-request: sqlalchemy#11558 Pull-request-sha: 44e4f51 Change-Id: I34c6a367bef158a0c6cf01f185e18392552b7cc7
1 parent 83b0690 commit f9a865c

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. change::
2+
:tags: bug, reflection, oracle
3+
:tickets: 11557
4+
5+
Fixed table reflection on Oracle 10.2 and older where compression options
6+
are not supported.

lib/sqlalchemy/dialects/oracle/base.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,8 +2051,16 @@ def _table_options_query(
20512051
):
20522052
query = select(
20532053
dictionary.all_tables.c.table_name,
2054-
dictionary.all_tables.c.compression,
2055-
dictionary.all_tables.c.compress_for,
2054+
(
2055+
dictionary.all_tables.c.compression
2056+
if self._supports_table_compression
2057+
else sql.null().label("compression")
2058+
),
2059+
(
2060+
dictionary.all_tables.c.compress_for
2061+
if self._supports_table_compress_for
2062+
else sql.null().label("compress_for")
2063+
),
20562064
).where(dictionary.all_tables.c.owner == owner)
20572065
if has_filter_names:
20582066
query = query.where(

0 commit comments

Comments
 (0)