-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Milestone
Description
Migrated issue, originally created by Carlos Rivas
I understand that Oracle zxJDBC is not currently supported but, in my case, it seems that a simple fix has brought it back to life.
Currently, working with Oracle zxJDBC with Jython 2.7.1b2 fails:
Traceback (most recent call last):
File "/Users/carlos/projects/pydev/smaf-flask/main.py", line 70, in <module>
db.session.commit()
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/scoping.py", line 150, in do
return getattr(self.registry(), name)(*args, **kwargs)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/session.py", line 813, in commit
self.transaction.commit()
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/session.py", line 392, in commit
self._prepare_impl()
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/session.py", line 372, in _prepare_impl
self.session.flush()
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/session.py", line 2027, in flush
self._flush(objects)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/session.py", line 2145, in _flush
transaction.rollback(_capture_exception=True)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/session.py", line 2109, in _flush
flush_context.execute()
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/unitofwork.py", line 373, in execute
rec.execute(self)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/unitofwork.py", line 529, in execute
persistence.save_obj(self.mapper,
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/persistence.py", line 172, in save_obj
_emit_insert_statements(base_mapper, uowtransaction,
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/orm/persistence.py", line 799, in _emit_insert_statements
result = cached_connections[connection].\
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/engine/base.py", line 914, in execute
return meth(self, multiparams, params)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/engine/base.py", line 996, in _execute_clauseelement
compiled_sql = elem.compile(
File "<string>", line 1, in <lambda>
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/sql/elements.py", line 494, in compile
return self._compiler(dialect, bind=bind, **kw)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/sql/elements.py", line 500, in _compiler
return dialect.statement_compiler(dialect, self, **kw)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/dialects/oracle/base.py", line 581, in __init__
super(OracleCompiler, self).__init__(*args, **kwargs)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/sql/compiler.py", line 392, in __init__
Compiled.__init__(self, dialect, statement, **kwargs)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/sql/compiler.py", line 190, in __init__
self.string = self.process(self.statement, **compile_kwargs)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/sql/compiler.py", line 213, in process
return obj._compiler_dispatch(self, **kwargs)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch
return meth(self, **kw)
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/sql/compiler.py", line 1875, in visit_insert
returning_clause = self.returning_clause(
File "/opt/python/jyflask/Lib/site-packages/sqlalchemy/dialects/oracle/zxjdbc.py", line 74, in returning_clause
columns = [self.process(c, within_columns_clause=False,
AttributeError: 'OracleCompiler_zxjdbc' object has no attribute 'result_map'
It seems that the problem stems from within the zxjdbc.py file in oracle/dialects folder.
Changing line:
# within_columns_clause=False so that labels (foo AS bar) don't render
columns = [self.process(c, within_columns_clause=False,
result_map=self.result_map)
for c in self.returning_cols]
to:
# within_columns_clause=False so that labels (foo AS bar) don't render
columns = [self.process(c, within_columns_clause=False,
result_map=self._create_result_map())
for c in self.returning_cols]
seems to fix the issue. I've searched BitBucket for an existing ticket but to no avail. Please, can you let me know that this is the correct approach to fix this file? Thanks!
I should also note that I used Oracle 11.2.0.4.0 ojdbc6.jar
Attachments: oracle_poc.txt
Reactions are currently unavailable