Hello group,
The query below ran in 0.3.x, but no longer works in 0.4.x. I have
checked the documentation but did not find an "easy" way of getting
the code to work again.
role = self.sasn.query(Role).get_by(nick=sgn_nick)
Even though the query is on "Role" I was able to search by the field
"nick" which is actually in "Signin". "Role" and "Signin" have a one-
to-one relationship.
Reading some of the filter_by() documentation I don't see any way of
doing it as easily and concisely as with the old get_by() expression
for this one-to-one relationship case.
What is the equivalent of this get_by() call with SQLAlchemy 0.4.6?
Here are the actual mappings:
mapper(Role, tables.role, properties={
'id_': tables.role.c.role_id,
'name': tables.role.c.role_name,
'signin': relation(Signin, uselist=False),
'perms': relation(Perm, secondary=tables.role_x_perm,
lazy=True),
'surveys': relation(Survey, secondary=tables.role_x_survey,
lazy=True),
'evals': relation(Eval, secondary=tables.role_x_eval,
lazy=True),})
mapper(Signin, tables.signin, properties={
'id_': tables.signin.c.sgn_id,
'nick': tables.signin.c.sgn_nick,
'secret': tables.signin.c.sgn_secret,
'is_enabled': tables.signin.c.sgn_is_enabled,
'lang_pref': tables.signin.c.lang_iso_639_code,})
Thanks, Marek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---