I need to document the "from_obj" parameter better:

subq = users.select(order_by=[users.c.username], limit=2).alias('users')

select(
        [subq.c.username, roles.c.role],
        from_obj = [
                subq.join(roles, subq.c.username==roles.c.username)
        ]
)

On Mar 16, 2006, at 4:43 AM, sifu wrote:

hi!

i'm not able to come up with a way to express the following postgresql
query with sqlalchemy:

SELECT users.username, roles.role
FROM ( SELECT * FROM users ORDER BY username LIMIT 2 ) AS users
LEFT JOIN roles ON users.username = roles.username;

i hope someone can help me out here :)

what i want to achieve (and what the postgresql query does):
i have to tables one with users one with all the roles of an user.
and i want to get 2 users but with all the roles they have.

thanks in advance!
sifu
ps: sqlalchemy is awesome! the only limiting factor seems to be my stupidity :)


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to