[sqlalchemy] Re: Possible bug in orm/state.py

2009-05-26 Thread Bob Farrell
On May 23, 7:56 pm, Michael Bayer mike...@zzzcomputing.com wrote: On May 23, 2009, at 1:47 PM, Bob Farrell wrote: Hi, using scoped_session(sessionmaker()) to create my sessions, if I hammer a request (using Pylons) by repeatedly clicking on a link that uses the ORM somewhat

[sqlalchemy] Performance

2009-05-26 Thread Marcin Krol
Hello everyone, Basically, I have some performance issues. Here's a somewhat complicated story: I have a Host class with several relations to OS_family, OS_version, OS_release, Project, Reservation, etc. The entire (sanitized) SQL log is too big to be posted here, so I copied it into

[sqlalchemy] Re: Performance

2009-05-26 Thread Mike Conley
On Tue, May 26, 2009 at 5:11 AM, Marcin Krol mrk...@gmail.com wrote: What I do not get is why after this query takes place, SQLA runs a lot those small queries - I included all (most?) the necessary columns in the big initial query, so Host data should be filled in by SQLA eager loading

[sqlalchemy] Re: Performance

2009-05-26 Thread Marcin Krol
Hello Mike, Mike Conley wrote: Are you assuming eager loading on the relation and actually getting lazy loading? Per the docs, lazy loading is the default unless you specify lazy=False http://www.sqlalchemy.org/docs/05/reference/orm/mapping.html#sqlalchemy.orm.relation I have changed

[sqlalchemy] Re: Performance

2009-05-26 Thread Michael Bayer
When you load all those objects, saying query(A, B, C, D).from_statement(huge statement), what you're not doing is loading collections on individual objects, and depending on what your mappings look like you may not be loading enough information for many-to-one associations to occur either.

[sqlalchemy] Re: Possible bug in orm/state.py

2009-05-26 Thread Bob Farrell
On May 26, 3:31 pm, Michael Bayer mike...@zzzcomputing.com wrote: Bob Farrell wrote: Hi Michael, I found this (your writing) in a thread from quite a while back: A common pattern which can cause what you see there is if your templates are accessing lazy loaders on objects, but the

[sqlalchemy] Re: Automatically filtering all queries

2009-05-26 Thread Denis S. Otkidach
On 26 май, 18:24, Michael Bayer mike...@zzzcomputing.com wrote: Denis S. Otkidach wrote: such ability in SQLAlchemy. There is a suggestion ( http://groups.google.com/group/sqlalchemy/browse_thread/thread/bcd10e... ) to provide custom query_cls. This probably worked a year ago, but

[sqlalchemy] Re: Possible bug in orm/state.py

2009-05-26 Thread Michael Bayer
Bob Farrell wrote: Hi Michael, I found this (your writing) in a thread from quite a while back: A common pattern which can cause what you see there is if your templates are accessing lazy loaders on objects, but the Session which loaded those objects had been clear()'ed or otherwise closed

[sqlalchemy] Changes in exc.py causing problems.

2009-05-26 Thread Bob Farrell
Hi hi. £ diff SQLAlchemy-0.5.2-py2.5.egg/sqlalchemy/exc.py SQLAlchemy-0.5.4p1- py2.5.egg/sqlalchemy/exc.py 134a135,139 if len(self.params) 10: return ' '.join((SQLAlchemyError.__str__(self), repr(self.statement),

[sqlalchemy] Re: Automatically filtering all queries

2009-05-26 Thread Michael Bayer
Denis S. Otkidach wrote: Do you mean I have to create separate model definitions for public and private parts of site? It doesn't seem sane to me. I've used such filtering across all tables for over 10 years with other DB tools, and it saved me a lot of work. Why not using it with SA? I've

[sqlalchemy] Re: Changes in exc.py causing problems.

2009-05-26 Thread Michael Bayer
this is all fixed in the current trunk. release probably today as the issue you have below is more severe than the one I had noticed. Bob Farrell wrote: Hi hi. £ diff SQLAlchemy-0.5.2-py2.5.egg/sqlalchemy/exc.py SQLAlchemy-0.5.4p1- py2.5.egg/sqlalchemy/exc.py 134a135,139 if

[sqlalchemy] Questions on SQLA Queries

2009-05-26 Thread Harish Vishwanath
Hello, Question 1: When there is a query like below : q = session.query(User.name) #(User is a class) and when I do q.all(), a list of tuples (User.name,) is returned though a single column is asked for. Is there a way to get a list directly from q.all() when a single column is required?

[sqlalchemy] SQLAlchemy 0.5.4p2 released

2009-05-26 Thread Michael Bayer
This release fixes some critical issues involving the formatting of DBAPI exceptions which were introduced in 0.5.4 and is recommended for all users. Download 0.5.4p2 at: http://www.sqlalchemy.org/download.html 0.5.4p2 === - sql - Repaired the printing of SQL exceptions which are not