On Jun 20, 2008, at 7:19 PM, mdmarek wrote:
> > 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? you need to do the joins explicitly; query(Role).join('signin').filter_by(nick=whatever).first(). the 0.3 behavior relied upon guessing and assumption to achieve its behavior so has been removed. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---