Mike Bayer avatar Mike Bayer committed f8e1d5a

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

Comments (0)

Files changed (3)

lib/sqlalchemy/schema.py

         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')
 

test/engine/execute.py

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

test/engine/reflection.py

             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,
         )
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.