Re: PEP 249 - DB API question
- From: "James Mills" <prologic@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 5 Nov 2008 04:30:32 +1000
On Wed, Nov 5, 2008 at 3:52 AM, k3xji <sumerc@xxxxxxxxx> wrote:
As development goes on for a server project, it turns out that I am
using the MySQLDB and DB interactions excessively. One questions is
just bothering me, why don't we have a timeout for queries in PEP 249
(DB API)?
Because not all database engines support this ?
Is it really safe to wait for a query to finish, means, is it always
returning, even if the DB server goes down?
Try using the non-blocking features (may be RDBMS specific)
And, also from my point view, it may be a good feature. We may use
long/non-critical DB queries with a timeout and slow/critical without
a timeout. This will give us a little chance to prioritize/consume
queries on their criticality? And, I don't see so much effort in
implementing this. One has to change the socket logic in the related
DB's API source code?
Patches are welcome. A suggestion:
Try spawning a new process to run your query
in. Use the multiprocessing library. Your main
application can then just poll the db/query processes
to see if they're a) finished and b) have a result
Your application server can also c0 kill long running
queries that are "deemed" to be taking "too long"
and may not finish (eg: Cartesian Joins).
--JamesMills
--
--
-- "Problems are solved by method"
.
- Follow-Ups:
- Re: PEP 249 - DB API question
- From: Lawrence D'Oliveiro
- Re: PEP 249 - DB API question
- From: k3xji
- Re: PEP 249 - DB API question
- References:
- PEP 249 - DB API question
- From: k3xji
- PEP 249 - DB API question
- Prev by Date: Re: Parse each line by character location
- Next by Date: Re: python_and_WSDL
- Previous by thread: PEP 249 - DB API question
- Next by thread: Re: PEP 249 - DB API question
- Index(es):
Relevant Pages
|