The 'Text' type implies the usage of CLOB on oracle, which with cx_ oracle implies a LOB object that has a 'read()' method. With a varchar just use the sqlalchemy String or VARCHAR types with your table metadata to handle the incoming data appropriately.
On Nov 25, 2010, at 1:33 PM, Alexander Zhabotinskiy <[email protected]> wrote: > Hello > > This is oracle table and query. I have no idea why the query isn't > work. Where it takes unicode? > > Regards > > > sqlplus desc staff; > > NCL NOT NULL NUMBER(17) > FAMILYNAME VARCHAR2(40) > FIRSTNAME VARCHAR2(40) > LASTNAME VARCHAR2(40) > BURN DATE > TABNUM VARCHAR2(21) > DSOV_ISP VARCHAR2(4000) > OSN VARCHAR2(4000) > SOVMEST VARCHAR2(4000) > > > staff_table = Table('STAFF', metadata, > Column('NCL', types.Integer, nullable=False, primary_key=True), > Column('FAMILYNAME', types.String(40)), > Column('FIRSTNAME', types.String(40)), > Column('LASTNAME', types.String(40)), > Column('BURN', types.Date), > Column('TABNUM', types.String(21)), > Column('DSOV_ISP', types.Text), > Column('OSN', types.Text), > Column('SOVMEST', types.Text), > ) > > > > query = Session.query(Staff).all() > File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/query.py", > line 1453, in all > return list(self) > File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/query.py", > line 1676, in instances > rows = [process[0](row, None) for row in fetch] > File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/mapper.py", > line 2234, in _instance > populate_state(state, dict_, row, isnew, only_load_props) > File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/mapper.py", > line 2113, in populate_state > populator(state, dict_, row) > File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/ > strategies.py", line 127, in new_execute > dict_[key] = row[col] > File "/usr/lib/python2.6/dist-packages/sqlalchemy/dialects/oracle/ > cx_oracle.py", line 143, in process > return value.read() > AttributeError: 'unicode' object has no attribute 'read' > > -- > 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. > -- 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.
