I meant __key__ not __key.

On Tue, Aug 30, 2011 at 2:51 PM, Stephen Johnson <[email protected]>wrote:

> You definitely can do queries by your keys. I'm not a Python person but it
> looks to me like your problem is that you've forgotten the <= part of the
> query so you get the _slides objects because _slides is > _blocks. You also
> get faq, default, shipping etc. because the underscore character is less
> than in Unicode (and thus ASCII) than the lower case letters. So try adding:
> __key++ <= :2 where :2 is a key equal to '_blocks' + \uFFFD'
>
> Stephen
> www.cortexconnect.com
>
> On Tue, Aug 30, 2011 at 1:39 PM, S.Prymak <[email protected]> wrote:
>
>> Here is why comparing key does not work:
>>
>> import models
>>
>>  pk=models.Page(key_name='_blocks')
>>
>>  q=models.Page.gql("WHERE __key__ >= :1", pk.key())
>>
>>  [p.key().name() for p in q]
>>
>> [u'_blocks--callout', u'_blocks--callout-contact', 
>> u'_blocks--footer-center', u'_blocks--teaser', u'_slides--home--1', 
>> u'about', u'collections', u'default', u'faq', u'shipping']
>>
>>
>>
>> In my implementation key name is a "slug" for page. I want only those
>> pages wich slug begins with '_blocks'. Is it possible quering by key
>> name?
>>
>> I thought about [p for p in models.Page.all() if p.key().name() >=
>> '_blocks'], but I doubt it has good perfomance on large set of entities.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-appengine/-/Z8h6AQSoQw4J.
>>
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to