[DB-SIG] Can the cursor.execute method have a timeout specified?

Mihai Ibanescu misa at redhat.com
Fri Aug 6 19:59:26 CEST 2004


On Fri, Aug 06, 2004 at 05:24:55PM +0000, Anjum Naseer wrote:
> Hi,
> 
> I am running a query which takes a long time and was wondering if there was 
> any way of specifying a timeout?

Although you probably fake a timeout through signal handlers, I doubt you
really want to do that. A query that runs for a long time is a bad query; you
should look into optimizing the query or the schema or breaking out the query
into smaller chunks.

Run a couple of these queries and the database backend will not be happy. Much
less will your DBA.

My opinion at least.
Misa

> c = adodbapi.connect("Provider=SQLOLEDB;Initial Catalog=Test;Data 
> Source=(local);Integrated Security=SSPI")
> csr = c.cursor()
> csr.arraysize = 1000
> csr.execute(someLongLastingQuery)
> 
> Thanks in advance.
> 
> _________________________________________________________________
> Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
> 
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig


More information about the DB-SIG mailing list