So there's a call upon first connect which is along the lines of:

SELECT CAST('test unicode returns' AS VARCHAR(60 CHAR)) AS anon_1 FROM DUAL

when you're on oracle 8, it should be checking server version, and coming out 
as:

SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1 FROM DUAL

so step one is make sure the second statement works on Oracle 8.   step two, 
we'd have to make sure the server version detection is working.   you can force 
this particular case like:

engine = create_engine('oracle://...')
engine.dialect.supports_char_length = False

besides that, I'd like to see:


engine = create_engine('oracle://...')
try:
    engine.connect()
except:
    # because we know its not working
    pass
print engine.dialect.server_version_info


this particular interaction doesn't go through regular SQLAlchemy logging.  If 
you really needed to see it occur you'd have to watch your oracle query logs.







On May 17, 2010, at 3:37 PM, Kent wrote:

> After migrating to 0.6, we've got an apparently well running
> application for postgres and Oracle 9 or above.  However, as soon as
> we connect to an Oracle 8 database, *everything* we attempt ends with
> this: oracle error: "ORA-00907: missing right parenthesis"
> 
> 
> Here is an example trying to run a session query.......:
> 
>>>> DBSession.query(SystemParameter).all()
> 12:35:01,294 INFO  [sqlalchemy.engine.base.Engine.0x...5650] SELECT
> USER FROM DUAL
> 12:35:01,294 INFO  [sqlalchemy.engine.base.Engine.0x...5650] {}
> Traceback (most recent call last):
>  File "<console>", line 1, in <module>
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/orm/query.py", line
> 1343, in all
>    return list(self)
>  File "/home/rarch/trunk/src/appserver/pylotengine/__init__.py", line
> 73, in __iter__
>    return Query.__iter__(self)
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/orm/query.py", line
> 1451, in __iter__
>    return self._execute_and_instances(context)
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/orm/query.py", line
> 1456, in _execute_and_instances
>    mapper=self._mapper_zero_or_none())
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/orm/session.py",
> line 736, in execute
>    return self._connection_for_bind(engine,
> close_with_result=True).execute(
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/orm/session.py",
> line 701, in _connection_for_bind
>    return self.transaction._connection_for_bind(engine)
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/orm/session.py",
> line 319, in _connection_for_bind
>    conn = bind.contextual_connect()
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
> line 1592, in contextual_connect
>    return self.Connection(self, self.pool.connect(),
> close_with_result=close_with_result, **kwargs)
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 154,
> in connect
>    return _ConnectionFairy(self).checkout()
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 318,
> in __init__
>    rec = self._connection_record = pool.get()
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 173,
> in get
>    return self.do_get()
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 665,
> in do_get
>    con = self.create_connection()
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 134,
> in create_connection
>    return _ConnectionRecord(self)
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 214,
> in __init__
>    l.first_connect(self.connection, self)
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/engine/
> strategies.py", line 145, in first_connect
>    dialect.initialize(c)
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/dialects/oracle/
> base.py", line 604, in initialize
>    super(OracleDialect, self).initialize(connection)
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/engine/default.py",
> line 138, in initialize
>    self.returns_unicode_strings =
> self._check_unicode_returns(connection)
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/engine/default.py",
> line 183, in _check_unicode_returns
>    unicode_for_varchar = check_unicode(sqltypes.VARCHAR(60))
>  File "/home/rarch/tg2env/lib/python2.6/site-packages/
> SQLAlchemy-0.6.0-py2.6-linux-x86_64.egg/sqlalchemy/engine/default.py",
> line 173, in check_unicode
>    ]).compile(dialect=self)
> DatabaseError: ORA-00907: missing right parenthesis
> 
> 
> Any ideas?  Any logging we can enable to help figure this out?
> 
> Thanks in advance.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to