> hello -
>
> you generally use mapper() and relation() to set up how you'd like
> your classes to correspond to your table relationships.  as far as
> compound keys, if they are defined with a "primary key" constraint you
> shouldn't have to worry about them.
---------------
Ok. So we are using mapper() function to map a python class to a database.

In my model.py I have
#Initial import packages...
from sqlalchemy import *
from turbogears.database import metadata, session,bind_meta_data
from sqlalchemy.ext.assignmapper import assign_mapper
from sqlalchemy.ext.activemapper import *
from turbogears import widgets, validators

bind_meta_data()
users_table = Table('users', metadata, autoload=True)

class Users(object):
    pass

usersmapper=mapper(Users,users_table)

mysession=session.query(Users)

1. What would be the code from now on to query all Users? Does
'mysession'  have a connection to a database already?

2. How do I select a user where User_Sid=100?

Why doesn't this work?
jj=[]
for users in session.query(Users):
    jj.append(users.Users_Sid)

What is the simples way to query my database to get user with user_sid=100?
What is the simples way to query my database to get user
last_name='Smith' with user_sid=100?

Thanks,
Lucas

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