- attached sa-oracle-map-tc.py
Incorrect mapping for RAW Oracle column types.
There is some inconsistency in the mapping of OracleRaw and OracleBinary type to the corresponding sqltype which throws the following error with both version 0.4.1 and SVN HEAD when running the attached test case which attempts to map a Oracle System View which has columns of type RAW:
Traceback (most recent call last):
File "sqlalchemy-svn\lib\sa-oracle-map-tc.py", line 21, in <mo
dule>
create_session().query(MetaType).all()
File "sqlalchemy-svn\lib\sqlalchemy\orm\query.py", line 676, i
n all
return list(self)
File "sqlalchemy-svn\lib\sqlalchemy\orm\query.py", line 737, i
n __iter__
return self._execute_and_instances(context)
File "sqlalchemy-svn\lib\sqlalchemy\orm\query.py", line 742, i
n _execute_and_instances
return iter(self.instances(result, querycontext=querycontext))
File "sqlalchemy-svn\lib\sqlalchemy\orm\query.py", line 808, i
n instances
rows.append(main(context, row))
File "sqlalchemy-svn\lib\sqlalchemy\orm\query.py", line 766, i
n main
extension=context.extension, only_load_props=context.only_load_props, refres
h_instance=context.refresh_instance
File "sqlalchemy-svn\lib\sqlalchemy\orm\mapper.py", line 1356,
in _instance
self.populate_instance(context, instance, row, only_load_props=only_load_pro
ps, instancekey=identitykey, isnew=isnew)
File "sqlalchemy-svn\lib\sqlalchemy\orm\mapper.py", line 1444,
in populate_instance
selectcontext.exec_with_path(self, key, populator, instance, row, ispostsele
ct=ispostselect, isnew=isnew, **flags)
File "sqlalchemy-svn\lib\sqlalchemy\orm\query.py", line 1336,
in exec_with_path
return func(*args, **kwargs)
File "sqlalchemy-svn\lib\sqlalchemy\orm\strategies.py", line 7
9, in new_execute
instance.__dict__[self.key](self.key) = row[self.columns[0](self.columns[0)]
File "sqlalchemy-svn\lib\sqlalchemy\engine\base.py", line 1256
, in __getitem__
return self.__parent._get_col(self.__row, key)
File "sqlalchemy-svn\lib\sqlalchemy\engine\base.py", line 1510
, in _get_col
return processor(row[index](index))
File "sqlalchemy-svn\lib\sqlalchemy\databases\oracle.py", line
137, in process
return value.read()
AttributeError: 'str' object has no attribute 'read'
The attached patch, against SVN, which maps sqltypes.Binary to OracleRaw and sqltypes.BLOB to OracleBinary seems to solve the problem.
Comments (6)
-
Account Deleted -
Account Deleted - attached sa-oracle-map.patch
Patch.
-
repo owner - changed status to resolved
I took a more simplistic approach to fixing this in 65c618534ff5c6401d1e6f6318e3e4c6b1516204, since i wanted to keep the type hierarchy the same.
-
Account Deleted - removed status
- changed status to open
The simplistic approach doesn't work for me. With the current code in trunk, i cannot have sqlalchemy create a column of datatype Raw.
With the simplified patch, reflection works fine, but table creation is broken. The original patch fixes both.
-
repo owner - changed status to resolved
Ok, OracleRaw adaptation is fixed in f16c41b00bd13a7c41412cf0aba46c1ced9a107d.
-
repo owner - removed milestone
Removing milestone: 0.4.xx (automated comment)
- Log in to comment
Test case.