Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-12-01 Thread Michael Bayer
both issues, same-named attributes on dual subclasses and structural subqueryloads in conjunction with with_polymorphic, are now repaired in the latest tip for 0.8 and both test scripts are functional in 0.8 now.Feel free to test it out and send me more feedback, thanks ! On Nov 23, 2012

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-26 Thread Michael Bayer
thanks, stick to 0.7 for now, http://www.sqlalchemy.org/trac/ticket/2617. On Nov 26, 2012, at 5:45 AM, Martin84 wrote: > Hi Michael Bayer, > > maybe I found a further sqlalchemy bug. If you add to the human<->houses > relationship a lazy='subquery' parameter, then sqlalchemy throws an keyerr

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-26 Thread Martin84
Hi Michael Bayer, maybe I found a further sqlalchemy bug. If you add to the human<->houses relationship a lazy='subquery' parameter, then sqlalchemy throws an keyerror. Check this script: http://pastebin.com/2ihWMZBA Am Freitag, 23. November 2012 17:37:00 UTC+1 schrieb Michael Bayer: > > > O

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-23 Thread Martin84
Hi Diana & Michael Bayer, thanks a lot for your help and time. I will use the workaround or change the database schema. Good to know, that sqlalchemy has such a helpful community! Bye Am Freitag, 23. November 2012 17:37:00 UTC+1 schrieb Michael Bayer: > > > On Nov 23, 2012, at 3:38 AM, Martin

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-23 Thread Michael Bayer
On Nov 23, 2012, at 3:38 AM, Martin84 wrote: > Hi Diana & Michael Bayer, > > thanks for your help! > So, you both use sqlalchemy 0.8 and I use 0.7.9 and that explains our > different SQL queries. > Now, with the join_depth=1 parameter the unexplainable SQL queries disappear > and there is no

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-23 Thread Michael Bayer
On Nov 23, 2012, at 11:05 AM, Michael Bayer wrote: > > Child refers to its parent via id_human, is a many-to-one - a Child can only > have *one* human. your script assigns newChild twice, once to newMen, once > to newWoman. assigning it to newWoman essentially removes it from newMen. cance

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-23 Thread Michael Bayer
On Nov 23, 2012, at 3:38 AM, Martin84 wrote: > Hi Diana & Michael Bayer, > > thanks for your help! > So, you both use sqlalchemy 0.8 and I use 0.7.9 and that explains our > different SQL queries. > Now, with the join_depth=1 parameter the unexplainable SQL queries disappear > and there is no

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-23 Thread Martin84
Hi Diana & Michael Bayer, thanks for your help! So, you both use sqlalchemy 0.8 and I use 0.7.9 and that explains our different SQL queries. Now, with the join_depth=1 parameter the unexplainable SQL queries disappear and there is no more difference between lazy='subquery' and subqueryload().

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-22 Thread Michael Bayer
On Nov 22, 2012, at 11:16 AM, Martin84 wrote: > Hi Diana & Michael Bayer, > > you both have exactly the same results/sql queries, but unfortunately my > results are different. This is really strange, > here is my complete python script with my output: http://pastebin.com/CyCs90cW As a side not

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-22 Thread Martin84
Hi Diana & Michael Bayer, you both have exactly the same results/sql queries, but unfortunately my results are different. This is really strange, here is my complete python script with my output: http://pastebin.com/CyCs90cW In my case the lazy='subquery' parameter have no effect and the sql qu

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-22 Thread Michael Bayer
what is awkward about this mapping is that the "myChildren" relationship is established twice, specific to the Men and Woman subclasses. SQLAlchemy doesn't have any with_polymorphic instruction here when it loads Human objects, so when you say Human->(some attribute that is only on Men/Woman) i

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-22 Thread Diana Clarke
Hmm maybe I'm missing something. Perhaps someone else can jump in, and show me what I'm missing? When I take your code, and execute the following 5 cases: CASE A: no 'subquery' on relationship, 'subqueryload' on query CASE B: 'subquery' on relationship, no 'subqueryload' on query

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-22 Thread Martin84
Hi Diana, thank you for your help, but unfortunately my problem still exists. In my case the lazy attribute for the myChildren relationship has absolutely no effect! At this point one more information is important: I build and populate the database with one session, and then open a new session

Re: [sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-21 Thread Diana Clarke
Morning Martin: I could be wrong, but I think what you're looking for is lazy='joined' rather than lazy='subquery'. When I change the following, I see one query per showDatabase() call rather than two. class Men(Human): myChildren = relationship('Child', secondary=link_table, lazy

[sqlalchemy] Unexplainable SQL queries / Performance issues

2012-11-21 Thread Martin84
Hi, I use SQLalchemy 0.7.9 with SQLite and have a performance issue. I have a simple database with joined table inheritance and some relationships. In short: I have a base class Human, and 3 subclasses (Men, Woman and Child), and I have a class House. The house class have a many to many relat