how to use db connection multiple times with scheduler?

38 views
Skip to first unread message

Amit

unread,
Jul 20, 2012, 2:52:51 AM7/20/12
to web...@googlegroups.com
hi,
I have to implement one scenario where scheduler will make the query to database periodically to retrieve data(lets say every 10 mins), i have written function inside model db.py to retrieve the data, and from controller i am staring the scheduler and assign the job to get the data periodically.

Problem:
when i request the function of controller  where i am starting scheduler from web browser , its executing perfectly and display the data first time , after that it started throwing error "ProgrammingError: Cannot operate on a closed database." continuously and i found that for each request models are executed DAL(...) statement and when action is done it will commit and rollback the db connection so because of that when scheduler tries to retrieve data second time from database using db , its throwing above mentioned error.

Note: I am using sqlite databse and APScheduler..

How to implement  this scenario where request come very first time i need to start scheduler and assign the job so periodically it should query to db and retrieve the data(second time onwards to db instance should be alive) ?
 
Reply all
Reply to author
Forward
0 new messages