On Thu, Aug 1, 2013 at 10:44 AM, Loic Bistuer wrote:
> On Aug 1, 2013, at 4:05 PM, Tom Evans wrote:
>
>> qs = ...
>> print len(qs)
>> print qs[0]
>> print qs[-1]
>> print qs[0]
>>
>> How many queries for this?
>
> Just one and "qs[-1]" will
On Aug 1, 2013, at 4:05 PM, Tom Evans wrote:
> qs = ...
> print len(qs)
> print qs[0]
> print qs[-1]
> print qs[0]
>
> How many queries for this?
Just one and "qs[-1]" will return the last element of the cached result.
I'm not trying to be pedantic, I'm just pointing
On Wed, Jul 31, 2013 at 7:39 PM, Loic Bistuer wrote:
> In your example "print qs[0]" evaluates a *clone* of "qs", not "qs" itself.
>
> Therefore "qs[0]; qs[-1]; qs[0]" triggers 3 queries, just like "qs[0]; qs[0];
> qs[0]" would.
>
Fine, be pedantic:
qs = ...
print
Is that from django-pyodbc or a very old version of django-mssql?
The recent versions of django-mssql use SELECT ROW_NUMBER() OVER (...) to
avoid some of the issues with flipping the order multiple times. The
biggest issue is that order is not guaranteed without explicitly specifying
the order
On Tue, Jul 30, 2013 at 4:04 PM, Wim Lewis wrote:
>
> On 30 Jul 2013, at 2:06 PM, Florian Apolloner wrote:
>> How do you think such support would look like? For negative indices you'd
>> have to know the size of the resultset to be able to do "limit somthing
>> offset
On Wed, 2013-07-31 at 13:01 +0100, Simon Riggs wrote:
> 3) retrieve via DESC, apply LIMIT and then re-sort by ASC using derived table
...
> (3) would require two sorts on the data like this
>
> SELECT * FROM (rest-of-query ORDER BY ... DESC LIMIT n ) ORDER BY ... ASC
I haven't followed this
In your example "print qs[0]" evaluates a *clone* of "qs", not "qs" itself.
Therefore "qs[0]; qs[-1]; qs[0]" triggers 3 queries, just like "qs[0]; qs[0];
qs[0]" would.
Now, if you really evaluate your "qs", for example by doing "list(qs)", then
further slicing/indexing on "qs" would operate on
On Tue, Jul 30, 2013 at 11:04 PM, Wim Lewis wrote:
>
> On 30 Jul 2013, at 2:06 PM, Florian Apolloner wrote:
>> How do you think such support would look like? For negative indices you'd
>> have to know the size of the resultset to be able to do "limit somthing
>> offset
On Wed, Jul 31, 2013 at 6:54 AM, Daniele Procida wrote:
> On Tue, Jul 30, 2013, Andre Terra wrote:
>
> >As for the reasons for disallowing negative indexes, dcramer's comment in
> >the ticket makes it clear: there is no way to infer what the last item in
On 31 July 2013 07:56, Florian Apolloner wrote:
> Hi Wim,
>
>
> On Wednesday, July 31, 2013 12:04:42 AM UTC+2, Wim Lewis wrote:
>>
>> On 30 Jul 2013, at 2:06 PM, Florian Apolloner wrote:
>> > How do you think such support would look like? For negative indices
>> > you'd
On Tue, Jul 30, 2013, Andre Terra wrote:
>As for the reasons for disallowing negative indexes, dcramer's comment in
>the ticket makes it clear: there is no way to infer what the last item in a
>query would be, except if you order it descendingly. For what is worth,
Hi Wim,
On Wednesday, July 31, 2013 12:04:42 AM UTC+2, Wim Lewis wrote:
>
> On 30 Jul 2013, at 2:06 PM, Florian Apolloner wrote:
> > How do you think such support would look like? For negative indices
> you'd have to know the size of the resultset to be able to do "limit
> somthing offset
On Wednesday, July 31, 2013 1:03:31 AM UTC+2, Andre Terra wrote:
>
> On Tue, Jul 30, 2013 at 6:55 PM, Florian Apolloner
> > wrote:
>
>> Right, it depends on your usecase; I was just trying to point out other
>> alternatives aside from the ones mentioned on the ticket.
>
>
On Tue, Jul 30, 2013 at 6:55 PM, Florian Apolloner wrote:
> Right, it depends on your usecase; I was just trying to point out other
> alternatives aside from the ones mentioned on the ticket.
I'm sorry if I seemed arrogant in my post. I most definitely did not intend
it,
On 30 Jul 2013, at 2:06 PM, Florian Apolloner wrote:
> How do you think such support would look like? For negative indices you'd
> have to know the size of the resultset to be able to do "limit somthing
> offset length-your_negative_index" -- this doesn't seem to make any sense for
> an ORM.
On Tuesday, July 30, 2013 11:34:18 PM UTC+2, Andre Terra wrote:
>
> On Tue, Jul 30, 2013 at 6:06 PM, Florian Apolloner
> > wrote:
>
>> You can always do list(qs)]:-1] though…
>
>
> Although you really shouldn't [1].
Right, it depends on your usecase; I was just trying to
On Tue, Jul 30, 2013 at 6:06 PM, Florian Apolloner wrote:
> You can always do list(qs)]:-1] though…
Although you really shouldn't [1].
As for the reasons for disallowing negative indexes, dcramer's comment in
the ticket makes it clear: there is no way to infer what the
Hi Mark,
How do you think such support would look like? For negative indices you'd
have to know the size of the resultset to be able to do "limit somthing
offset length-your_negative_index" -- this doesn't seem to make any sense
for an ORM. You can always do list(qs)]:-1] though…
Cheers,
In this support ticket (https://code.djangoproject.com/ticket/13089), the
original closer said "This is a long-standing explicit design decision in
the ORM, and so gets a wontfix...". What is the reasoning behind this? Why
is negative indexing of querysets disallowed?
Thanks!
--
You received
19 matches
Mail list logo