I am doing some experimenting with this, and it would appear that Psycopg2 (not sure about postgres itself) can not handle unicode column names. sqlite and mysql adapters do handle unicode table and column names.
so in changeset 2447, I have made some adjustments so that unicode table names and column names are supported. there is also a unit test that does some INSERTs and tests out a basic mapping with one relationship both lazy- and eager-loaded, and it passes on sqlite and mysql so far. however the names I am using have just a single non- ascii character present; with a full set of chinese characters, that might raise more issues. In particular the following regular expression has to work with chinese characters (which it *should*...) match = re.compile(r'(?<!:):([\w_]+)', re.UNICODE) the main thing being that the "\w" matcher will allow all characters in your column name to be matched as "alphanumeric" with the UNICODE flag enabled. So you should check out the latest trunk and begin working with it. I would label this support as "preliminary" since more testing will be needed. Additionally, check out the unit tests test/sql/unicode.py, which illustrates two ways to do mappings with unicode names. one defines a "key" inside each Column with a plain string name, the other defines a plain string name on the mapper itself. On Mar 27, 2007, at 7:27 AM, Chen Houwu wrote: > > I mean non-ascii column names defined in my database table. > SqlServer, Oracle, MySql...all of the mainstream DBMS support this > feature, > In east asia(China, Japan, Korea), non-ascii column names and table > names,together with non-ascii strings in record > are widely used. > > On 3月25日, 下午10时55分, Michael Bayer <[EMAIL PROTECTED]> > wrote: >> non-ascii attribute names in your Python code ? or non-ascii column >> names defined in your database table ? I didnt know the latter was >> possible with most databases. >> >> On Mar 25, 2007, at 1:04 AM, Chen Houwu wrote: >> >> >> >>> from the sqlalchemy documentation, >>> I found when table definition >>> (e.g >>>>>> users_table = Table('users', metadata, >>> ... Column('user_id', Integer, primary_key=True), >>> ... Column('user_name', String(40)), >>> ... Column('password', String(10)) >>> ... ) >>> ) >> >>> and a class >>> (e.g. >>>>>> class User(object): >>> ... pass >>> ) >> >>> are mapped together, >>> the column name in the column definition(e.g. 'password') are mapped >>> into an attribute of the class, >>> but python only accept ASCII attribute name. >>> so, >>> What if the above "password" is a word in Chinese GB2312 encoding? >> >>> Does it mean I can't deal with column name which is not ASCII? > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---