here's what i had to add to get set of queries to intersect:

      def __hash__(self): return hash(self.key())

      def __eq__(self, other):
          return self.key() == other.key()

      def __ne__(self, other):
          return not self == other


i dunno if thats optimum but it works ..

Note that this will cause a query to fetch the entire results from the
datastore. You dont want that unless you have absolutely no other
solution.

(I ditched a huge portion of my initial code that used sets in favor
of a few more queries, and was able to optimize the CPU time for my
requests a whopping 600%! .. thats how expensive those operations
were. unfortunately this has exposed another major flaw i am now in
the process of trying to fix. but that story is for another time.)

if youre simply trying to query for results that include all but ONE
particular entry, wouldn't 'WHERE __key__ != :1', direct2.key() ... do
the trick ?

im no expert really. just my two cents.


On Feb 22, 12:14 pm, Paul Roy <paul.ro...@gmail.com> wrote:
> i believe this as to do with how object instances are evaluated for  
> equality in python.
>
> ive had a similar issue and if i recall correctly (im on my phone atm  
> and not close to my code), i needed to implement __eq__ & __ne__ (or  
> whatever non equal is, i cant remember) to my Model object subclasses.
>
> Sent from my iPhone
>
> On 09-02-21, at 20:51, MajorProgamming <sefira...@gmail.com> wrote:
>
>
>
> > I currently have a need to take a result from a query (which is a
> > list) and remove one entity from it. For some reason though when I
> > perform the remove, I get an error which says that the entity does not
> > exist on the list. How can I do this correctly?
>
> > Code:
> > #excerpt:
> > #wx and wx2 are db.Query objects with filters...
> > #I want to remove wx2 from wx
> > direct=wx2.get()
> > wx=wx.fetch(limit=50)
> > wx.remove(direct)
> > #this code returns an error. I know for a fact (through debugging)
> > that wx2 entity exists in the wx result.
>
> > Thanks,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to