1. Marc Abramowitz
  2. sqlalchemy


Mike Bayer  committed f8e1d5a

fixing recent schema.py changes to work with oracle 'owner' attribute

  • Participants
  • Parent commits 058cb84
  • Branches default
  • Tags rel_0_4_3

Comments (0)

Files changed (3)

File lib/sqlalchemy/schema.py

View file
         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()
         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:
         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')

File test/engine/execute.py

View file
             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'})

File test/engine/reflection.py

View file
             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()),