Marco Mariani wrote: >Lee McFadden wrote: > > >>Going from the line number in your exception that would be because >>your columns are of type String. Change the columns to Unicode and it >>should solve your problem. >> >>foo_table = Table('foo', metadata, >> Column('id', Integer, primary_key=True), >> Column('bar', Unicode(255)) >>) >> >> >> > >In case you're using reflection: > > > Overriding Reflected Columns > >Individual columns can be overridden with explicit values when >reflecting tables; this is handy for specifying custom datatypes, >constraints such as primary keys that may not be configured within the >database, etc. > > > >>>>mytable = Table('mytable', meta, >>>> >>>> >... Column('id', Integer, primary_key=True), # override reflected 'id' to >have primary key >... Column('mydata', Unicode(50)), # override reflected 'mydata' to be >Unicode >... autoload=True) > ><http://www.sqlalchemy.org/docs/metadata.myt#metadata> >or use convert_unicode=True in create_engine, as I do, it should help. > >In my case, I have UTF8 as default encoding for postgres, and SA >reflects columns as PGString. > > > > Ciao Marco,
I replaced line 7 with line 8 in my model but the error is still there... 1 from turbogears import database 2 from sqlalchemy import Table, relation 3 from sqlalchemy.engine import create_engine 4 from sqlalchemy.ext.assignmapper import assign_mapper 5 database.bind_meta_data() 6 session = database.session 7 # engine = database.metadata.engine 8 engine = create_engine("postgres://username:[EMAIL PROTECTED]/sfera", convert_unicode=True, encoding='utf-8') 9 context = session.context ... jo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---