[sqlalchemy] Re: InvalidRequestError: get() can only be used against a single mapped class.

2011-12-28 Thread Kent
On Dec 28, 12:07 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 28, 2011, at 11:34 AM, Kent wrote: Was it your intention to no longer allow this type of query().get()? session.query(cls.orderid).get(orderid) it was !   yes. I get InvalidRequestError: get() can only be

[sqlalchemy] Re: InvalidRequestError: get() can only be used against a single mapped class.

2011-12-28 Thread Kent
in fact, I modified our Query class after .first() was being abused out of laziness: def first(self): raise ProgrammingError(Never use .first(); please use .get() or .one()\n .one() makes sure there is only one return and .get() returns None if doesn't exist.\n