I put a check in the method to check if the rows are being returned, if so 
I am extracting the rows and calling result.close(). For Insert I am 
banking on default close() call. Which solved my problem.

On Monday, September 22, 2014 4:39:17 PM UTC-5, Michael Bayer wrote:
>
>
> On Sep 22, 2014, at 4:21 PM, Milind Vaidya <kav...@gmail.com <javascript:>> 
> wrote: 
>
> > 
> > In simple words my application is doing following thing, 
> > 
> > There are 'n' tracks (some entity in business logic context) 
> > every 5 mins per track have a thread--->each thread will spawn 5 threads 
> per mins--> now each of these threads will fetch data from web service and 
> insert into DB. 
> > 
> > 
> > class DBHandler(object): 
> >     '''Handles generic DB related operations''' 
> > 
> >     def __init__(self): 
> >         global engine 
> >         self.session = Session(bind=engine) 
> > 
> >     def execute_query(): 
> > 
> > 
> > def insert_data(): 
> >        dbh = DBHandler() 
> > 
> > 
> > 
> > def fetch_insert_data() 
> >       fetch_data() 
> >       insert_data() 
> > 
> > 
> > def processing(track) 
> >           create 5 threads per minute in 5 min interval and call 
> fetch_insert_data(track, minute_value) 
> > 
> > def main(): 
> >           create thread per track and call processing(track) 
> >       
> > 90% of the queries are insert queries and very few are fetch with no 
> complex joins or anything. I understand that it will be difficult to get 
> the whole picture with these code snippets. 
>
> the “out of sync” error means connections/cursors are being used in an 
> order that’s not expected, I’ve given you all the info I have on this. 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to