diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-17 19:43:45 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-17 19:43:45 -0400 |
| commit | e3f07f7206cf0d6a5f2ff9344a365f4657645338 (patch) | |
| tree | 4cc5b438354fd374f4bdd8719251341b6030efb0 /lib/sqlalchemy/testing/suite | |
| parent | 1f2f88d8ffaac5ae98de097e548e205778686cd5 (diff) | |
| download | sqlalchemy-e3f07f7206cf0d6a5f2ff9344a365f4657645338.tar.gz | |
- Added support for the Oracle table option ON COMMIT. This is being
kept separate from Postgresql's ON COMMIT for now even though ON COMMIT
is in the SQL standard; the option is still very specific to temp tables
and we eventually would provide a more first class temporary table
feature.
- oracle can apparently do get_temp_table_names() too, so implement that,
fix its get_table_names(), and add it to #3204. fixes #3204 again.
Diffstat (limited to 'lib/sqlalchemy/testing/suite')
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_reflection.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py index 690a880bb..60db9eb47 100644 --- a/lib/sqlalchemy/testing/suite/test_reflection.py +++ b/lib/sqlalchemy/testing/suite/test_reflection.py @@ -100,19 +100,31 @@ class ComponentReflectionTest(fixtures.TablesTest): @classmethod def define_temp_tables(cls, metadata): - temp_table = Table( + # cheat a bit, we should fix this with some dialect-level + # temp table fixture + if testing.against("oracle"): + kw = { + 'prefixes': ["GLOBAL TEMPORARY"], + 'oracle_on_commit': 'PRESERVE ROWS' + } + else: + kw = { + 'prefixes': ["TEMPORARY"], + } + + user_tmp = Table( "user_tmp", metadata, Column("id", sa.INT, primary_key=True), Column('name', sa.VARCHAR(50)), Column('foo', sa.INT), sa.UniqueConstraint('name', name='user_tmp_uq'), sa.Index("user_tmp_ix", "foo"), - prefixes=['TEMPORARY'] + **kw ) if testing.requires.view_reflection.enabled and \ testing.requires.temporary_views.enabled: event.listen( - temp_table, "after_create", + user_tmp, "after_create", DDL("create temporary view user_tmp_v as " "select * from user_tmp") ) @@ -186,7 +198,7 @@ class ComponentReflectionTest(fixtures.TablesTest): @testing.requires.temp_table_names def test_get_temp_table_names(self): - insp = inspect(self.metadata.bind) + insp = inspect(testing.db) temp_table_names = insp.get_temp_table_names() eq_(sorted(temp_table_names), ['user_tmp']) @@ -485,6 +497,7 @@ class ComponentReflectionTest(fixtures.TablesTest): self._test_get_unique_constraints() @testing.requires.temp_table_reflection + @testing.requires.unique_constraint_reflection def test_get_temp_table_unique_constraints(self): insp = inspect(self.metadata.bind) eq_( @@ -503,7 +516,6 @@ class ComponentReflectionTest(fixtures.TablesTest): [{'unique': False, 'column_names': ['foo'], 'name': 'user_tmp_ix'}] ) - @testing.requires.unique_constraint_reflection @testing.requires.schemas def test_get_unique_constraints_with_schema(self): |
