Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102200

Re: Question about asyncio and blocking operations

From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Question about asyncio and blocking operations
Date 2016-01-28 17:20 -0700
Message-ID <mailman.67.1454026859.2338.python-list@python.org> (permalink)
References (11 earlier) <n8dgas$s1u$1@ger.gmane.org> <CALwzidn6NfT_O0cfHw1itWja81+MW3scHuEcADVCen3ix6z73w@mail.gmail.com> <CAGqiJR-kbF2HDTPRG=49yEDkyZZRQbUC-=3Dq_bApab2exsKAw@mail.gmail.com> <CALwzidm49eYvx6E2fW0MXHmqZkQ0z40hSWwcH8J259sZuKthfQ@mail.gmail.com> <CAGqiJR9ZyfND2O89mHX3u8TztRNjZDYPkQVV_Z_VGSsMFxDZ9w@mail.gmail.com>

Show all headers | View raw


On Jan 28, 2016 3:07 PM, "Maxime Steisel" <maximesteisel@gmail.com> wrote:
>
> But it is a pretty strange idea to call two fetch*() method concurrently
anyways.

If you want to process rows concurrently and aren't concerned with
processing them in order, it may be attractive to create multiple threads /
coroutines, pass the cursor to each, and let them each call fetchmany
independently. I agree this is a bad idea unless you use a lock to isolate
the calls or are certain that you'll never use a dbapi implementation with
threadsafety < 3.

I pointed it out because the wrapper makes it less obvious that multiple
threads are involved; one could naively assume that the separate calls are
isolated by the event loop.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Question about asyncio and blocking operations Ian Kelly <ian.g.kelly@gmail.com> - 2016-01-28 17:20 -0700

csiph-web