On 8/16/06, Grzesiek Slusarek <[EMAIL PROTECTED]> wrote:
> Hi all! I have situation like that, I want use in my Python class
> atributes others that names that I used in metadata(cols names in
> database).
> So i want to achieve something like that:
> METADATA
> users_table = Table('users', metadata,
> ...     Column('user_id', Integer, primary_key=True),
> ...     Column('user_name', String(40)),
> ...     Column('password', String(10))
> ... )
> and python class(I took example from tutorial)
> class User(object):
> ...     def __repr__(self):
> ...         return "(User %s,password:%s)" % (self.userName,
> self.passwd)
> there are no cols userName and passwd so it must be translation or
> something from user_name and password.
> Is it possible to do like that?
> And what is the right way to do this?
> Thanks for any help
> Gregor

Basically, when defining your mapper, you use the "properties"
argument to set the names of the attributes in the Python class and
which database columns they correspond to. See
http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_properties_colname
for details.

-- 
Robin Munn
[EMAIL PROTECTED]
GPG key 0xD6497014

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to