You can have multiple "indexes" on the many side. Decouple the ListProperty
in its own model and use a key only query to find the ancestor key. Then a
db.get will get you what you want.
Example:
class Dude(db.Model):
name = db.StringProperty()
class DudeIndex(db.Model):
relates_to = db.StringListProperty()
def relate_to(dude_entity, *relations):
db.put(DudeIndex(parent=dude_entity, relates_to=relations))
def get_dude_that_relates_to(other_dude):
index_key = DudeIndex.all(keys_only=True).filter('relates_to',
other_dude).get()
if index_key:
return db.get(index_key.parent())
- alkis
On Tue, Mar 23, 2010 at 5:09 PM, jpuopolo <[email protected]> wrote:
> All,
>
> I am building an application where I need to model a 1-many
> relationship. The "many" side of the relationship needs to scale to
> about 1 million items at maximum. In his talk, Building Scalable and
> Complex Apps, Brett Slatkin suggests using ListProperty to model this
> type of relationship; however, ListProperty imposes a limit of 5000
> indexed properties --- a far cry from the million I need (and,
> unfortunately, these items must be indexed so that I can find "one"
> side of the relationship by querying the "many" side).
>
> So, I have a few questions:
>
> 1. If I could make it so that the many side of the relationship did
> not need indexing, can a ListProperty deal with 1 million (non-
> indexed) items?
>
> 2. If I require indexing on the many side, is there another approach
> that will work? My only other design alternative, I think, is to use a
> link entity (a -> link entity -> b). This allows me to use
> ReferenceProperty and it associated collection set.
>
> Thoughts? Am I missing something?
>
> Thanks,
> John
>
> --
> 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]<google-appengine%[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.