]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixing recent schema.py changes to work with oracle 'owner' attribute rel_0_4_3
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 14 Feb 2008 23:41:17 +0000 (23:41 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 14 Feb 2008 23:41:17 +0000 (23:41 +0000)
lib/sqlalchemy/schema.py
test/engine/execute.py
test/engine/reflection.py

index 3a2ff97a7b893fb04db0f1b45b86fee9e4b486ff..a3aa9ecc63aff6fdb77436208c3590f76783a8e1 100644 (file)
@@ -196,6 +196,7 @@ class Table(SchemaItem, expression.TableClause):
         super(Table, self).__init__(name)
         self.metadata = metadata
         self.schema = kwargs.pop('schema', None)
+        self.owner = kwargs.pop('owner', None)
         self.indexes = util.Set()
         self.constraints = util.Set()
         self._columns = expression.ColumnCollection()
@@ -232,7 +233,13 @@ class Table(SchemaItem, expression.TableClause):
         schema = kwargs.pop('schema', None)
         if schema and schema != self.schema:
             raise exceptions.ArgumentError("Can't change schema of existing table from '%s' to '%s'", (self.schema, schema))
-            
+        owner = kwargs.pop('owner', None)
+        if owner:
+            if not self.owner:
+                self.owner = owner
+            elif owner != self.owner:
+                raise exceptions.ArgumentError("Can't change owner of existing table from '%s' to '%s'", (self.owner, owner))
+    
         include_columns = kwargs.pop('include_columns', None)
         if include_columns:
             for c in self.c:
@@ -246,12 +253,11 @@ class Table(SchemaItem, expression.TableClause):
         the 'useexisting' flag overrides this.
         """
 
-        return bool(args) or bool(util.Set(kwargs).difference(['autoload', 'autoload_with', 'schema']))
+        return bool(args) or bool(util.Set(kwargs).difference(['autoload', 'autoload_with', 'schema', 'owner']))
         
     def __post_init(self, *args, **kwargs):
         self.quote = kwargs.pop('quote', False)
         self.quote_schema = kwargs.pop('quote_schema', False)
-        self.owner = kwargs.pop('owner', None)
         if kwargs.get('info'):
             self._info = kwargs.pop('info')
 
index 643a22a185a8489478ebaae158a233c5c18ecdb4..260a05e270d85730d9a8647d71969811be169533 100644 (file)
@@ -55,7 +55,7 @@ class ExecuteTest(TestBase):
             assert res.fetchall() == [(1, "jack"), (2, "ed"), (3, "horse"), (4, 'sally')]
             conn.execute("delete from users")
 
-    @testing.fails_on_everything_except('sqlite')
+    @testing.fails_on_everything_except('sqlite', 'oracle')
     def test_raw_named(self):
         for conn in (testing.db, testing.db.connect()):
             conn.execute("insert into users (user_id, user_name) values (:id, :name)", {'id':1, 'name':'jack'})
index 127a46a1d1d5365c84154f53b3463048e1062a54..c9a07835c3c81f0753ca269ab2fa257580d6ba2a 100644 (file)
@@ -27,8 +27,7 @@ class ReflectionTest(TestBase, ComparesTables):
             Column('test8', Binary),
             Column('test_passivedefault2', Integer, PassiveDefault("5")),
             Column('test9', Binary(100)),
-            Column('test10', Boolean),
-            Column('test_numeric', Numeric(None, None)),
+            Column('test_numeric', Numeric()),
             test_needs_fk=True,
         )