[sqlalchemy] Re: Advice on complicated (?) SQL query

2007-10-20 Thread pbienst
If you allow me some more questions, I can now retrieve info from the cards table using: s = select([card_table.c.id],(card_table.c.key.in_(s_inner)) ) Similarly from the revision table s = select([repetition_table.c.actual_interval_s], (repetition_table.c.rep_number==3) & (repetition_table.c.c

[sqlalchemy] Re: Advice on complicated (?) SQL query

2007-10-20 Thread pbienst
Barry Hart wrote: > Try this for the outer query: > > >s = > select([repetition_table.c.grade],(repetition_table.c.rep_number==2) & > (repetition_table.c.card_key.in_(s_inner)) ) Great, that did the trick! Thanks, Peter --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Re: Advice on complicated (?) SQL query

2007-10-20 Thread pbienst
Thanks! Based on your suggestion, I tried the following: The inner query goes like this: >repetition_table_2 = repetition_table.alias() >s_inner = select([repetition_table_2.c.card_key], (repetition_table_2.c.rep_number==5) & \ (repetition_table_2.c.grade==2)).limit(10) >

[sqlalchemy] Advice on complicated (?) SQL query

2007-10-18 Thread pbienst
Hi, I have a query which works fine through the ORM, albeit a bit slow, so I want to drop down to the SQL layer to speed things up. However, being an SQL novice, I can't seem to figure out how to get it to work. I have a database containing the history of repetitions with a flash card program. I

[sqlalchemy] Re: speed advice? (lot of time spent in attributes.py)

2007-10-15 Thread pbienst
Michael Bayer wrote: > yeah your error was a simple one, just a primary key collision, so if > its not doing that it should be fine. i didnt look to see exactly > why it was doing what it was, it seems like you might be manually > setting primary key fields somewhere which was producing the sam

[sqlalchemy] Re: speed advice? (lot of time spent in attributes.py)

2007-10-15 Thread pbienst
I wrote: > My database state should be OK if I don't get an error? More specifically I mean the following. If I do: -create A -save A -flush -create B -save B If I now do a query asking for the last item in the database, would I get A or B? If I get A, I need to flush all the time, and then I

[sqlalchemy] Re: speed advice? (lot of time spent in attributes.py)

2007-10-15 Thread pbienst
> So for now id turn > the autoflush off and flush changes manually when database state is > needed..while i noticed that turning off autoflush entirely seems to > prevent the proper generation of primary keys here, it makes it all > the way to the commit() and the point of issuing SQL in about 7

[sqlalchemy] speed advice? (lot of time spent in attributes.py)

2007-10-15 Thread pbienst
2.2000.000 weakref.py: 218(__getitem__) My scripts and a sample logfile can be found at: http://users.ugent.be/~pbienst/pub/logparse.tgz Thanks for any light you can shed on this! Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed t