[google-appengine] Re: Superclass.get_by_key_name(subclass_instance.key_name) doesn't work

2009-01-21 Thread theillustratedlife
On Dec 11 2008, 6:02 am, Andy Freeman ana...@earthlink.net wrote: I thought that he was asking about properties that are present in some instances and not others.  If a given instance doesn't have a given property, it isn't indexed by that property and one would hope that there'd be no

[google-appengine] Re: Superclass.get_by_key_name(subclass_instance.key_name) doesn't work

2008-12-11 Thread Andy Freeman
Any indexable property will cost a couple million cpu cycle when you put a new entity. You should set them to text or blob to avoid index penalty. I thought that he was asking about properties that are present in some instances and not others. If a given instance doesn't have a given

[google-appengine] Re: Superclass.get_by_key_name(subclass_instance.key_name) doesn't work

2008-12-10 Thread Andy Freeman
While GAE application code may use subclasses, the GAE datastore does not have any knowledge of the relationship between different entity types. You can encode the class name/kind in your key name and then use db.class_for_kind to get the class. However, db.class_for_kind is not part of the

[google-appengine] Re: Superclass.get_by_key_name(subclass_instance.key_name) doesn't work

2008-12-10 Thread theillustratedlife
Thanks Andy. It's nice to know all the hidden features. =) If the datastore doesn't know about subclasses, I'm not sure they're worth using. Couldn't I give Question all the properties I might need, but only provide values to the ones each instance uses? Is there any sort of penalty for

[google-appengine] Re: Superclass.get_by_key_name(subclass_instance.key_name) doesn't work

2008-12-10 Thread Andy Freeman
If the datastore doesn't know about subclasses, I'm not sure they're worth using. I find that they help me with my code, but YMMV. (In particular, I often define db.ReferenceProperty s that only accept a base class and always fill them in with in instance of some subclass. That's better for

[google-appengine] Re: Superclass.get_by_key_name(subclass_instance.key_name) doesn't work

2008-12-10 Thread theillustratedlife
Thanks Andy. For now, I think I'm going to roll all the subclasses into the superclass. I only have 4 subclasses anyway, and they each only have an additional property or two. That seems to me to be the cleanest solution. You've been very helpful/informative. Good man.

[google-appengine] Re: Superclass.get_by_key_name(subclass_instance.key_name) doesn't work

2008-12-10 Thread yejun
On Dec 10, 3:38 pm, theillustratedlife [EMAIL PROTECTED] wrote: Thanks Andy.  It's nice to know all the hidden features.  =) If the datastore doesn't know about subclasses, I'm not sure they're worth using.  Couldn't I give Question all the properties I might need, but only provide values to