diff options
| -rw-r--r-- | doc/build/changelog/unreleased_13/5146.rst | 7 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/oracle/base.py | 2 | ||||
| -rw-r--r-- | test/dialect/oracle/test_reflection.py | 5 |
3 files changed, 13 insertions, 1 deletions
diff --git a/doc/build/changelog/unreleased_13/5146.rst b/doc/build/changelog/unreleased_13/5146.rst new file mode 100644 index 000000000..d216c752a --- /dev/null +++ b/doc/build/changelog/unreleased_13/5146.rst @@ -0,0 +1,7 @@ +.. change:: + :tags: bug, oracle + :tickets: 5146 + + Fixed a reflection bug where table comments could only be retrieved for + tables actually owned by the user but not for tables visible to the user + but owned by someone else. Pull request courtesy Dave Hirschfeld. diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py index f6de4de68..c89e441b9 100644 --- a/lib/sqlalchemy/dialects/oracle/base.py +++ b/lib/sqlalchemy/dialects/oracle/base.py @@ -1760,7 +1760,7 @@ class OracleDialect(default.DefaultDialect): COMMENT_SQL = """ SELECT comments - FROM user_tab_comments + FROM all_tab_comments WHERE table_name = :table_name """ diff --git a/test/dialect/oracle/test_reflection.py b/test/dialect/oracle/test_reflection.py index 6c36c0a6b..411ba335c 100644 --- a/test/dialect/oracle/test_reflection.py +++ b/test/dialect/oracle/test_reflection.py @@ -49,6 +49,8 @@ create table %(test_schema)s.parent( data varchar2(50) ); +COMMENT ON TABLE %(test_schema)s.parent IS 'my table comment'; + create table %(test_schema)s.child( id integer primary key, data varchar2(50), @@ -189,6 +191,9 @@ drop synonym %(test_schema)s.local_table; parent.join(child) ).execute().fetchall() + # check table comment (#5146) + eq_(parent.comment, "my table comment") + def test_reflect_local_to_remote(self): testing.db.execute( "CREATE TABLE localtable (id INTEGER " |
