Thank you for your help. I followed your advice and have overwritten the colums with umlauts with ascii-compatible names:
Table('foo', metadata, Column(u"someunicodename", key="someasciiname"), autoload=True ) To test this, i tried a "select" on my table, which resulted in another unicode-problem, because SQL-Alchemy is uses the original columnnames to generate sql code. What am I doing wrong? File 'c:\\TTL\\ttl\\controllers\\mlfb.py', line 18 in index_mlfb c.items=model.t_mlfb.select().order_by(column).execute() File 'c:\\python25\\lib\\site-packages\\sqlalchemy-0.4.5-py2.5.egg\ \sqlalchemy\\sql\\expression.py', line 1057 in execute return e.execute_clauseelement(self, multiparams, params) File 'c:\\python25\\lib\\site-packages\\sqlalchemy-0.4.5-py2.5.egg\ \sqlalchemy\\engine\\base.py', line 1219 in execute_clauseelement return connection.execute_clauseelement(elem, multiparams, params) File 'c:\\python25\\lib\\site-packages\\sqlalchemy-0.4.5-py2.5.egg\ \sqlalchemy\\engine\\base.py', line 895 in execute_clauseelement return self._execute_compiled(elem.compile(dialect=self.dialect, column_keys=keys, inline=len(params) > 1), distilled_params=params) File 'c:\\python25\\lib\\site-packages\\sqlalchemy-0.4.5-py2.5.egg\ \sqlalchemy\\engine\\base.py', line 910 in _execute_compiled return context.result() File 'c:\\python25\\lib\\site-packages\\sqlalchemy-0.4.5-py2.5.egg\ \sqlalchemy\\engine\\default.py', line 284 in result return self.get_result_proxy() File 'c:\\python25\\lib\\site-packages\\sqlalchemy-0.4.5-py2.5.egg\ \sqlalchemy\\engine\\default.py', line 293 in get_result_proxy return base.ResultProxy(self) File 'c:\\python25\\lib\\site-packages\\sqlalchemy-0.4.5-py2.5.egg\ \sqlalchemy\\engine\\base.py', line 1402 in __init__ self._init_metadata() File 'c:\\python25\\lib\\site-packages\\sqlalchemy-0.4.5-py2.5.egg\ \sqlalchemy\\engine\\base.py', line 1433 in _init_metadata colname = item[0].decode(self.dialect.encoding) File 'C:\\Python25\\lib\\encodings\\utf_8.py', line 16 in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 6-7: invalid data On 23 Apr., 15:07, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Apr 23, 2008, at 3:50 AM, Saibot wrote: > > > > > mapper.py", line 669, in _compile_property > > setattr(self.class_, key, Mapper._CompileOnAttr(self.class_, key)) > > File "c:\python25\lib\site-packages\sqlalchemy-0.4.4-py2.5.egg > > \sqlalchemy\orm\ > > mapper.py", line 539, in __init__ > > self.existing_prop = getattr(class_, key, None) > > UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in > > position 6: > > ordinal not in range(128) > > > Is there a way to tell orm.mapper() to encode the columnnames into > > iso-8859-1 rather than ascii? > > this error is specifically your mapper() attempting to assign a class- > bound descriptor to your class using a key name with non ASCII > characters in it. Python doesn't allow this, so you have to assign > "key" values to your columns, either like this, at the Table level: > > Table('foo', metadata, > Column("someunicodename", Integer, key="someasciiname"), > autoload=True > ) > > or like this, at the mapper() level: > > mapper(MyClass, mytable, properties={ > "someasciiname" : mytable.c['someunicodename'] > > > > })- Zitierten Text ausblenden - > > - Zitierten Text anzeigen - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---