Re: [Tutor] best approach to db-api imports and cursor calls

2009-08-13 Thread Christian Witts
Serdar Tumgoren wrote: But most folks find multiple cursors easier to manage in the same way that they find multiple variables easier than reusing a minimal number. That makes sense. I think I'll try using a global import/connect, and then create cursors inside each method. Thanks to you

Re: [Tutor] best approach to db-api imports and cursor calls

2009-08-13 Thread Serdar Tumgoren
> But most folks find multiple cursors easier to manage in the same way that > they find multiple variables easier than reusing a minimal number. > That makes sense. I think I'll try using a global import/connect, and then create cursors inside each method. Thanks to you both for the advice! _

Re: [Tutor] best approach to db-api imports and cursor calls

2009-08-13 Thread Alan Gauld
"Serdar Tumgoren" wrote Is there any reason why you can't reuse the same cursor object? I know when you're writing to a database, you have to be sure to commit your changes. But if I'm just issuing execute statements and then fetching data, is it okay to reuse the same cursor? No, there is no

Re: [Tutor] best approach to db-api imports and cursor calls

2009-08-12 Thread Serdar Tumgoren
> My understanding is that it is relatively expensive to connect() and > cheap to create cursors. Cursors are also associated with > transactions. So a common practice seems to be to create a connection > that is shared in some way, and to create a cursor for each > transaction / operation. > > Ken

[Tutor] best approach to db-api imports and cursor calls

2009-08-12 Thread Serdar Tumgoren
Hi everyone, Was wondering if you could advise on best practices when it comes to reusing a database cursor. I'm working on a program that must hit a database several times. Basically, I pull some data, process it, and then use a portion of that data as parameters for the next call. And then I rin