Re: PEP 249 - DB API question



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"
.



Relevant Pages

  • Re: How does one set read-uncommitted on the entire DB?
    ... queries to determine if the locking will become less of a problem. ... All client APIs permit you to set the timeout, ... Note that query timeout is unrelated to SQL Server. ...
    (comp.databases.ms-sqlserver)
  • Re: a proposed callout API
    ... Since nearly all callout_resetcalls use the same relative timeout as ... calculations in the API. ... in the low level callwheel code. ... per-cpu and to issue the callout on the same cpu it was registered on. ...
    (freebsd-arch)
  • Re: GPIB Multidevice API timeout
    ... the default command timeout is much too long to wait. ... this 'multidevice' API, that isn't an option. ... Does anybody know a GPIB command other than ibdev() that sets the bus ...
    (sci.electronics.design)
  • Re: wait_event_interruptible_timeout
    ... I have noticed an issue with wait_event_interruptible_timeoutAPI ... The process receives a signal and wakes up prematurely (i.e., ... before its timeout expired or the event of interest occurred). ... the timeout would have occurred (unslept or balance jiffies). ...
    (Linux-Kernel)
  • Avoid using DNS for hostname name resolution in ldap_bind_s
    ... perform LDAP queries with LDAP directories (Active Directory, ... host.domain.com) the LDAP API is trying to perform DNS queries to ... I have the relevant hostname & ip in a local hosts file and I would ...
    (microsoft.public.windows.server.active_directory)