[sqlalchemy] Blob Issue

25 views
Skip to first unread message
Message has been deleted

dhanil anupurath

unread,
May 17, 2010, 8:28:59 AM5/17/10
to sqlalchemy
Hi

I am having a trouble with SA-oracle-Blob datatype.
Here I have a test program like this.

import pkg_resources
pkg_resources.require("cx-Oracle>=5.0.3")
import cx_Oracle
import sqlalchemy
from sqlalchemy.sql import select

db=sqlalchemy.create_engine('oracle://cse:cse@localhost')
conn = db.connect()

result=conn.execute(select(["dummy"]))
print "helloooooooooooooo"
print result.fetchone()

conn.close()

cse is the username and password for ORACLE schema

duumy is the table name ,it has a column with datatype BLob.

For this am geting the result with the error,

ORA-00932: inconsistent datatypes: expected NUMBER got BLOB

Is there is any solution so that i do can do more complecated
select statements.

Is Blob not supported for ORACLE-SA

Any help is encouraged.

THANKS

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

Michael Bayer

unread,
May 17, 2010, 9:57:05 AM5/17/10
to sqlal...@googlegroups.com
cx_oracle requires special type handling with BLOB. You must pass full typing information to SQLAlchemy in order to have them handled directly.

The test case below doesn't make sense to me since "select(["dummy"])" would render "SELECT dummy FROM DUAL", which I didn't think was the same as "select * from dummy".

In any case, if you are using textual SQL and need typing information, use the text() construct, http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html#sqlalchemy.sql.expression.text , specifying typemap and bindparams as appropriate.

text("select * from dummy where foo=:bar", bindparams=[bindparam('bar', type_=String)], typemap={'a':Binary, 'b':String})
Reply all
Reply to author
Forward
0 new messages