Michael Bayer ha scritto: > On Dec 12, 2008, at 5:19 AM, jo wrote: > > >> Michael Bayer ha scritto: >> >>> Look into using the Unicode type for python unicode values. >>> >>> http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/types.html?highlight=unicode#sqlalchemy.Unicode >>> >>> >> This is the 0.5 documentation >> I'm using SQLAlchemy version 0.3.10. >> and cx_Oracle 4.3.1 >> >> Seems cx_Oracle isn't able to convert unicode values into integer. >> Take a look: >> >> In [32]: print Azienda.get(1).azienda_id >> 1 >> >> >> In [33]: print Azienda.id(u'1').azienda_id >> SQLError: (NotSupportedError) Variable_TypeByValue(): unhandled data >> type unicode 'SELECT azienda.id AS azienda_id \nFROM azienda \nWHERE >> azienda.id = :azienda_id ORDER BY azienda.rowid' {'azienda_id': u'1'} >> > > > 0.3 has the Unicode type as well, the same usage rules apply. > > However in this case you are supplying a string for an integer value > in a query. you have to supply an int, not a string. > Yes, I'm supplying a value directly from the url which is a text value as in:
www.myserver/azienda?id=1 I haven't this problem using the postgres adapter because psycopg casting automatically the value, instead cx_Oracle needs an explicit casting. I wonder if there's some parameter to tell cx_Oracle to do it in implict way. j > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
