[sqlalchemy] Misleading warning for SqlAlchemy?

2014-09-11 Thread Victor Reichert
Hi, I'm using flask-sqlahcmey and I have a self referential relationship like this: class FileData(db.Model): id = db.Column(db.Integer, primary_key = True) primary_file_data_id = db.Column(db.Integer, ForeignKey('file_data.id')) is_edited_file = db.Column(db.Boolean, default =

Re: [sqlalchemy] too many SQL variables in in_

2014-09-11 Thread Michael Bayer
On Sep 11, 2014, at 1:53 AM, pyArchInit ArcheoImagineers pyarchi...@gmail.com wrote: Hi, if I create many or request with a little number of id (list populated with 10 values), the script return to me this message: Expression tree is too large (maximum depth 1000) So, It's possibile

Re: [sqlalchemy] Misleading warning for SqlAlchemy?

2014-09-11 Thread Michael Bayer
you can filter the warnings as ALWAYS for now, and the warning here should probably not come out if you've in fact given remote_side so please raise an issue for that. On Sep 11, 2014, at 2:38 AM, Victor Reichert vfr...@gmail.com wrote: Hi, I'm using flask-sqlahcmey and I have a self

Re: [sqlalchemy] Misleading warning for SqlAlchemy?

2014-09-11 Thread Michael Bayer
OK, I made https://bitbucket.org/zzzeek/sqlalchemy/issue/3194/misleading-warning-when-non-column and that is fixed with a small patch. On Sep 11, 2014, at 9:10 AM, Michael Bayer mike...@zzzcomputing.com wrote: you can filter the warnings as ALWAYS for now, and the warning here should

[sqlalchemy] Re: SQLAlchemy connection errors

2014-09-11 Thread Matthijs Blaas
Hi Jonathan, Thanks for your response, i removed the newresponse event like you mentioned and added a finished callback to the request (in a tween): request.add_finished_callback(cleanup_db_session) Unfortunatly the plot thickens! Since the last time i tested our project, the problem

Re: [sqlalchemy] too many SQL variables in in_

2014-09-11 Thread Jonathan Vanasco
i once thought about extending SqlAlchemy to handle this issue behind the scenes, but each database treats `IN()` differently. for example: oracle maxes out at a number of elements, while mysql maxes out based on the size of the overall statement (which is configured on the server). it's too

Re: [sqlalchemy] does anyone have a trick for printing parenthesis on complex queries?

2014-09-11 Thread Jonathan Vanasco
On Wednesday, September 10, 2014 7:52:48 PM UTC-4, Michael Bayer wrote: might be tricky, there’s self_group() and Grouping(), you can probably use the latter explicitly. Yeah, I saw those. It would be too hard to re-engineer. Considering this is your answer, I'm going to give up hope and

[sqlalchemy] simple relationship join ends up in 1 s

2014-09-11 Thread tatütata Okay
Hey, I got some shop tables like: customerorders, itemsbought, products whole query with three joins takes nothing on command line sql. When I trying to achieve same thing with ORM and my relationship it takes 1 second, joining all three 3 tables 2 seconds? May I come first up with my table and

Re: [sqlalchemy] Misleading warning for SqlAlchemy?

2014-09-11 Thread Victor Reichert
Cool, thank you! On Thursday, September 11, 2014 8:52:45 AM UTC-7, Michael Bayer wrote: OK, I made https://bitbucket.org/zzzeek/sqlalchemy/issue/3194/misleading-warning-when-non-column and that is fixed with a small patch. On Sep 11, 2014, at 9:10 AM, Michael Bayer

Re: [sqlalchemy] simple relationship join ends up in 1 s

2014-09-11 Thread Michael Bayer
for some tips on isolating where the speed issue is, follow the steps at: http://docs.sqlalchemy.org/en/latest/faq.html#how-can-i-profile-a-sqlalchemy-powered-application for too many joins, you also want to look into EXPLAIN PLAN. On Sep 11, 2014, at 12:57 PM, tatütata Okay

Re: [sqlalchemy] simple relationship join ends up in 1 s

2014-09-11 Thread tatütata Okay
Yeah that would have been my next steps. I hoped more for some hints if the setup is correct more if there are issues with the relationship configuration? I think speed related things come up when there are over 10 entries and more? We speak here about 5000, thats why I think I did a mistake

Re: [sqlalchemy] simple relationship join ends up in 1 s

2014-09-11 Thread Michael Bayer
three joins over 100K rows is going to be very slow, two seconds seems in the ballpark. EXPLAIN will show if there are any table scans taking place. as far as why the relationship is faster, it might be doing something different, check the echo=True output. On Sep 11, 2014, at 2:35 PM,

Re: [sqlalchemy] simple relationship join ends up in 1 s

2014-09-11 Thread tatütata Okay
Okay will try it. Maybe you got it wrong. I have only 5 k rows On Thu, Sep 11, 2014 at 8:55 PM, Michael Bayer mike...@zzzcomputing.com wrote: three joins over 100K rows is going to be very slow, two seconds seems in the ballpark. EXPLAIN will show if there are any table scans taking place.

Re: [sqlalchemy] simple relationship join ends up in 1 s

2014-09-11 Thread Simon King
The query that you are doing: customerorders = sqlsession.query(Customerorder)\ .join(Itemsbought.order)\ .all() probably doesn't do what you intend. In particular, it doesn't populate the Customerorder.itemsbought collection. So when you iterate over customerorders and access the