summaryrefslogtreecommitdiff
path: root/test/dialect/test_oracle.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-10-25 19:11:53 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-10-25 19:11:53 -0400
commit5070c81ab963c1432bbbecf38d4cad7ac7b81652 (patch)
tree82c304f4b6d98b2f5373dba5bbd2ba5c5c1cd734 /test/dialect/test_oracle.py
parent3e67b32100cc5f8fd273d626b6a9acddb8ccb8fd (diff)
downloadsqlalchemy-5070c81ab963c1432bbbecf38d4cad7ac7b81652.tar.gz
- Fixed bug where Oracle table reflection using synonyms would fail
if the synonym and the table were in different remote schemas. Patch to fix courtesy Kyle Derr. [ticket:2853]
Diffstat (limited to 'test/dialect/test_oracle.py')
-rw-r--r--test/dialect/test_oracle.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/dialect/test_oracle.py b/test/dialect/test_oracle.py
index 1fde1c198..d843a2d9e 100644
--- a/test/dialect/test_oracle.py
+++ b/test/dialect/test_oracle.py
@@ -675,9 +675,18 @@ create table test_schema.child(
parent_id integer references test_schema.parent(id)
);
+create table local_table(
+ id integer primary key,
+ data varchar2(50)
+);
+
create synonym test_schema.ptable for test_schema.parent;
create synonym test_schema.ctable for test_schema.child;
+create synonym test_schema_ptable for test_schema.parent;
+
+create synonym test_schema.local_table for local_table;
+
-- can't make a ref from local schema to the
-- remote schema's table without this,
-- *and* cant give yourself a grant !
@@ -693,8 +702,12 @@ grant references on test_schema.child to public;
for stmt in """
drop table test_schema.child;
drop table test_schema.parent;
+drop table local_table;
drop synonym test_schema.ctable;
drop synonym test_schema.ptable;
+drop synonym test_schema_ptable;
+drop synonym test_schema.local_table;
+
""".split(";"):
if stmt.strip():
testing.db.execute(stmt)
@@ -719,6 +732,22 @@ drop synonym test_schema.ptable;
finally:
meta.drop_all()
+ def test_reflect_alt_table_owner_local_synonym(self):
+ meta = MetaData(testing.db)
+ parent = Table('test_schema_ptable', meta, autoload=True, oracle_resolve_synonyms=True)
+ self.assert_compile(parent.select(),
+ "SELECT test_schema_ptable.id, "
+ "test_schema_ptable.data FROM test_schema_ptable")
+ select([parent]).execute().fetchall()
+
+ def test_reflect_alt_synonym_owner_local_table(self):
+ meta = MetaData(testing.db)
+ parent = Table('local_table', meta, autoload=True, oracle_resolve_synonyms=True, schema="test_schema")
+ self.assert_compile(parent.select(),
+ "SELECT test_schema.local_table.id, "
+ "test_schema.local_table.data FROM test_schema.local_table")
+ select([parent]).execute().fetchall()
+
def test_create_same_names_implicit_schema(self):
meta = MetaData(testing.db)
parent = Table('parent', meta,