I'm new to ORMs, so please forgive me for this:

I've got a few tables where there's an integer column that foreign keys another table for a text value.

I'm used to just pre-caching all of the values and doing a lookup like
instance_type_id = _dbcache['instance_type']['name'] [ instance_type_name ]
        or
instance_type_name = _dbcache['instance_type']['id'] [ instance_type_id ]

I'm thinking that considering all the things the mapper does, somehow takes care of this as well.

Can someone point me in the right direction.

instance = Table('instance', __engine__,
    Column('id', Integer, primary_key=True),
Column('instance_type_id' , Integer , ForeignKey ("instance_type.id") ),
    Column('name', String(255)),
)
instance_type = Table('instance_type', __engine__,
    Column('id', Integer, primary_key=True),
    Column('name', String(255), unique=True),
)

Thanks.


-------------------------------------------------------
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