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


Groups > comp.lang.python > #102314 > unrolled thread

Re: Cannot step through asynchronous iterator manually

Started byMichael Torrie <torriem@gmail.com>
First post2016-01-30 14:57 -0700
Last post2016-01-30 14:57 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Cannot step through asynchronous iterator manually Michael Torrie <torriem@gmail.com> - 2016-01-30 14:57 -0700

#102314 — Re: Cannot step through asynchronous iterator manually

FromMichael Torrie <torriem@gmail.com>
Date2016-01-30 14:57 -0700
SubjectRe: Cannot step through asynchronous iterator manually
Message-ID<mailman.140.1454191090.2338.python-list@python.org>
On 01/30/2016 02:19 PM, Chris Angelico wrote:
> where the ... is the full original query. In other words, the whole
> query has to be run twice - once to assert that there's exactly one
> result, and then a second time to get that result. The existing
> algorithm ("try to fetch a row - if it fails error; then try to fetch
> another - if it succeeds, error") doesn't need to fetch more than two
> results, no matter how big the query result is.

Actually it occurs to me this doesn't have to be true.  The same
information he needs to know can be done with one query and only 1 result.

SELECT count(some_id_field),field1,field2,field3 FROM wherever WHERE
conditions

If the first column (or whatever you decide to alias it as) contains a
count, and the rest of the information is still there.  If count is 1,
then the row is what you want and you can do whatever you wish with it.
 If not, throw your exception.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web