from the docstring in
----
class Column:
    def __init__(....)
----
name
    The name of this column. This should be the identical name as it
appears, or will appear, in the database.

key
    Defaults to None: an optional alias name for this column. The
column will then be identified everywhere in an application, including
the column list on its Table, by this key, and not the given name.
Generated SQL, however, will still reference the column by its actual
name.

If I use a ascii key, and a non-ascii name according to the column in
the database, is there anything wrong?

I  *won't* solve the problem by "Overriding Column name in mapper
function", which is showed as following.
---------------------
Overriding Column Names

When mappers are constructed, by default the column names in the Table
metadata are used as the names of attributes on the mapped class. This
can be customzed within the properties by stating the key/column
combinations explicitly:

user_mapper = mapper(User, users_table, properties={
    'id' : users_table.c.user_id,
    'name' : users_table.c.user_name,
})
-----------------------

On 3月27日, 下午10时55分, "Chen Houwu" <[EMAIL PROTECTED]> wrote:
> But following the second post (see below), I have read the
> documentation,
> though not very carefully,  and have not validated it by test code,
> but the documentation really shows the solution to my problem.
>
> Have I misunderstood the documentation?
> ----------------------
> second post
> ----------------------
> "
> try Column()'s parameters quote=.. and key=..,
> doc/docstrings.html#docstrings_sqlalchemy.schema_Column
>
> and/or mapper's explicit column-naming:
> doc/adv_datamapping.html#advdatamapping_properties_colname
> "
> -----------------------
>
> On 3月27日, 下午10时24分, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
> > then there is currently no fix for your situation until this feature
> > is added to SA.
>
> > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to