[sqlalchemy] Removing a session (Really)

2011-06-26 Thread Warwick Prince
Hi Michael I'm having an issue with memory usage that I would appreciate some insight.. I have a fairly straight forward process, that works perfectly as far as it delivering the desired updates in the DB etc, however, it accumulates memory usage (just like a leak) and I can not find a way to

[sqlalchemy] slow get query - somes taking 1.5 sec

2011-06-26 Thread nospam
I'm seeing a simple get taking a considerable amount of time. a = session.query(Annotation).get(annotation.id) This line can take anywhere between 0.15 secs to all the way up to 1.5 secs ... The query sqlalchemy produces is below. If I execute the query in pgadmin, it consistently runs in 47

Re: [sqlalchemy] slow get query - somes taking 1.5 sec

2011-06-26 Thread Michael Bayer
You have a tremendous amount of LEFT OUTER JOINS in there, and its hard to tell but it seems like you're doing lots of with_polymorphic queries as well as lazy='joined' styles of relationships, making for a very cumbersome query. That it returns the first result quickly (that's your 47 msec)

Re: [sqlalchemy] Add helper methods to a model class

2011-06-26 Thread Michael Bayer
On Jun 25, 2011, at 10:59 PM, Arthur Kopatsy wrote: Hi, I have seen a few related questions but never a clear answer. I have a set of core models defined using a declarative form. These models are used by multiple applications. In each application we however want to extend this model

Re: [sqlalchemy] Removing a session (Really)

2011-06-26 Thread Michael Bayer
On Jun 26, 2011, at 4:31 AM, Warwick Prince wrote: Hi Michael I'm having an issue with memory usage that I would appreciate some insight.. I have a fairly straight forward process, that works perfectly as far as it delivering the desired updates in the DB etc, however, it accumulates

Re: [sqlalchemy] SQLAlchemy 0.6.5 (and 0.6.8) SessionExtension after_flush doesn't gets called

2011-06-26 Thread Michael Bayer
The flush events only fire off if there's actually something to be flushed. It would be inefficient for the events to be emitted for every flush() as flush is in fact called a great number of times, on every query, assuming autoflush enabled. For this reason a flush() with a session that has

[sqlalchemy] Re: Add helper methods to a model class

2011-06-26 Thread Arthur Kopatsy
Thanks Michael. However, I also want my queries to return objects with the helpers. The rebasing method does achieve this but I am not sure how the method you are describing will. Using mixin is interesting but it will force my applications to map them and therefore know about the table layout.

Re: [sqlalchemy] Re: Add helper methods to a model class

2011-06-26 Thread Michael Bayer
On Jun 26, 2011, at 2:51 PM, Arthur Kopatsy wrote: Thanks Michael. However, I also want my queries to return objects with the helpers. The rebasing method does achieve this but I am not sure how the method you are describing will. It absolutely does because the class you define with Base

[sqlalchemy] Re: Raising exceptions from TypeDecorator.process_bind_param()

2011-06-26 Thread Anton
Michael, On 22 июн, 17:48, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 22, 2011, at 3:41 AM, Anton wrote: On 22 июн, 01:31, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 21, 2011, at 7:04 PM, Anton wrote: On 22 июн, 00:47, Michael Bayer mike...@zzzcomputing.com wrote: I

Re: [sqlalchemy] Removing a session (Really)

2011-06-26 Thread Warwick Prince
Excellent - thanks :-) Warwick On 27/06/2011, at 2:37 AM, Michael Bayer wrote: On Jun 26, 2011, at 4:31 AM, Warwick Prince wrote: Hi Michael I'm having an issue with memory usage that I would appreciate some insight.. I have a fairly straight forward process, that works perfectly

Re: [sqlalchemy] Re: Raising exceptions from TypeDecorator.process_bind_param()

2011-06-26 Thread Michael Bayer
On Jun 26, 2011, at 6:13 PM, Anton wrote: Unfortunately this approach doesn't work with python 2.4 which doesn't allow multiple inherritance for exception classes, where one of parent classes is new-style: TypeError: exceptions must be classes, instances, or strings (deprecated), not

[sqlalchemy] Re: slow get query - somes taking 1.5 sec

2011-06-26 Thread nospam
Yes, I'm using polymorphic mappers. It's actually only 1 row - querying the object by id. I have lazy=false for any referenced objects to the one I'm querying for. On Jun 26, 12:16 pm, Michael Bayer mike...@zzzcomputing.com wrote: You have a tremendous amount of LEFT OUTER JOINS in there, and