[sqlalchemy] Overload session to add a filter to every query

2009-07-03 Thread cd34
I'm trying to overload session for an application so that I can add a filter to every query without having to manually enter it. I understand that session is a method, but, I haven't quite figured out what is required to add my filter. I have the following: engine = create_engine('mysql://user:

[sqlalchemy] Re: Interned tring

2009-07-03 Thread limscoder
Ok, thanks On Jun 29, 7:39 am, "Michael Bayer" wrote: > I'd use a TypeDecorator around String for that. > > limscoderwrote: > > > What I meant to say was: > > > Is there a way to automatically get interned strings when querying > > objects with String properties? > > > On Jun 28, 2:20 pm,limscod

[sqlalchemy] Re: 0.4 to 0.5 upgrade and 'One-to-many relation fails with "unsaved, pending instance and is an orphan"' error

2009-07-03 Thread Michael Bayer
oh man, i missed the biggest part of this one, after I noticed that you weren't doing anything to put the PhoneNumber in the session. Don't use Session.mapper. That is the main problem you're having in this specific case. Auto-adding free-standing objects to the session is a bad idea