[sqlalchemy] Sql alchemy-Oracle Error

2010-05-05 Thread dhanil anupurath
Hi

I am using sqlalchemy in my TurboGears application.
some of my classes has columns with Pickletype dataType.
these get converted to BLOB dataType in the database.
I was using mySql till recently and everything was working fine.

Now i am shifting to oracle. Tables are getting created properly.
(setup-app in tg project ran successfully). But when i try to query
a table having BLOB column ,  i get the following error.
Exception in thread Thread-22:
Traceback (most recent call last):
  File /usr/lib/python2.4/threading.py, line 442, in __bootstrap
self.run()
  File /svnee/trunk/src/core/services/task_service.py, line 76, in
check_calendar_tasks
for cal in conn.query(Task).\
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/orm/query.py, line 1361, in __iter__
return self._execute_and_instances(context)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/orm/query.py, line 1364, in
_execute_and_instances
result = self.session.execute(querycontext.statement,
params=self._params, mapper=self._mapper_zero_or_none())
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/orm/session.py, line 754, in execute
return self.__connection(engine, close_with_result=True).execute(
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/engine/base.py, line 824, in execute
return Connection.executors[c](self, object, multiparams, params)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/engine/base.py, line 874, in
_execute_clauseelement
return self.__execute_context(context)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/engine/base.py, line 896, in __execute_context
self._cursor_execute(context.cursor, context.statement,
context.parameters[0], context=context)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/engine/base.py, line 950, in _cursor_execute
self._handle_dbapi_exception(e, statement, parameters, cursor,
context)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/engine/base.py, line 931, in
_handle_dbapi_exception
raise exc.DBAPIError.instance(statement, parameters, e,
connection_invalidated=is_disconnect)
DatabaseError: (DatabaseError) ORA-01036: illegal variable name/number


i did a normal select query from sqlplus:

select * from tasks;
ORA-00932: inconsistent datatypes: expected NUMBER got BLOB

These are my class and table definitions:

class Task(DeclarativeBase):
task_id = Column(Integer,Sequence('id_seq'), primary_key=True)
task_type = Column(Unicode(50), default=to_unicode('Task'))
name = Column(Unicode(256))
entity_id = Column(Unicode(256))
entity_name = Column(Unicode(50))
context = Column(PickleType)
params = Column(PickleType)
kw_params = Column(PickleType)
processors = Column(ImmutablePickleType)


 _tablename_=tasks
TASK_ID  Number
TASK_TYPEVarchar2
NAME Varchar2
ENTITY_IDVarchar2
ENTITY_NAME  Varchar2
CONTEXT  Blob
PARAMS   Blob
KW_PARAMSBlob
PROCESSORS  Blob
USER_NAME   Varchar2
SUBMITTED_ON   Date 7
REPEATING   Number

anyone has any idea what's wrong?
please help .
Thanks

-- 
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.



Re: [sqlalchemy] Sql alchemy-Oracle Error

2010-05-05 Thread Jason Baker
On Wed, May 5, 2010 at 7:42 AM, dhanil anupurath
dhanilanupur...@gmail.comwrote:

 Hi

 I am using sqlalchemy in my TurboGears application.
 some of my classes has columns with Pickletype dataType.
 these get converted to BLOB dataType in the database.
 I was using mySql till recently and everything was working fine.

 Now i am shifting to oracle. Tables are getting created properly.
 (setup-app in tg project ran successfully). But when i try to query
 a table having BLOB column ,  i get the following error.
 Exception in thread Thread-22:
 Traceback (most recent call last):
  File /usr/lib/python2.4/threading.py, line 442, in __bootstrap
self.run()
  File /svnee/trunk/src/core/services/task_service.py, line 76, in
 check_calendar_tasks
for cal in conn.query(Task).\
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
 py2.4.egg/sqlalchemy/orm/query.py, line 1361, in __iter__
return self._execute_and_instances(context)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
 py2.4.egg/sqlalchemy/orm/query.py, line 1364, in
 _execute_and_instances
result = self.session.execute(querycontext.statement,
 params=self._params, mapper=self._mapper_zero_or_none())
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
 py2.4.egg/sqlalchemy/orm/session.py, line 754, in execute
return self.__connection(engine, close_with_result=True).execute(
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
 py2.4.egg/sqlalchemy/engine/base.py, line 824, in execute
return Connection.executors[c](self, object, multiparams, params)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
 py2.4.egg/sqlalchemy/engine/base.py, line 874, in
 _execute_clauseelement
return self.__execute_context(context)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
 py2.4.egg/sqlalchemy/engine/base.py, line 896, in __execute_context
self._cursor_execute(context.cursor, context.statement,
 context.parameters[0], context=context)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
 py2.4.egg/sqlalchemy/engine/base.py, line 950, in _cursor_execute
self._handle_dbapi_exception(e, statement, parameters, cursor,
 context)
  File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
 py2.4.egg/sqlalchemy/engine/base.py, line 931, in
 _handle_dbapi_exception
raise exc.DBAPIError.instance(statement, parameters, e,
 connection_invalidated=is_disconnect)
 DatabaseError: (DatabaseError) ORA-01036: illegal variable name/number


 i did a normal select query from sqlplus:

 select * from tasks;
 ORA-00932: inconsistent datatypes: expected NUMBER got BLOB

 These are my class and table definitions:

 class Task(DeclarativeBase):
task_id = Column(Integer,Sequence('id_seq'), primary_key=True)
task_type = Column(Unicode(50), default=to_unicode('Task'))
name = Column(Unicode(256))
entity_id = Column(Unicode(256))
entity_name = Column(Unicode(50))
context = Column(PickleType)
params = Column(PickleType)
kw_params = Column(PickleType)
processors = Column(ImmutablePickleType)


 _tablename_=tasks
TASK_ID  Number
TASK_TYPEVarchar2
NAME Varchar2
ENTITY_IDVarchar2
ENTITY_NAME  Varchar2
CONTEXT  Blob
PARAMS   Blob
KW_PARAMSBlob
PROCESSORS  Blob
USER_NAME   Varchar2
SUBMITTED_ON   Date 7
REPEATING   Number


Any chance you could send the query that's generating the python traceback?
You should be able to see the generated queries if you send echo=True in the
create_engine arguments.

-- 
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.