I think it could be very powerful to consider the following concept as
a way to ease data / relational integrity while still maintaing a sense
of denormalization.


Often times certain fields for a model may be replicated to maintain a
more embedded view of properties. This leaves the developer responsible
for its upkeep often times through db.keys / ReferenceProperties
between the model and its counterpart (relation). Would it be possible
to stream line this by specifying that a given field should be synced
to a model field; taking advantage of the backwards/forward relations
maintained by ReferenceProperties.


For example:




class Author(db.Model):
author_name = db.StringProperty()
sex = db.StringProperty()
birth_day = db.DateTimeProperty()
.....



class Story(db.Model):
author_key = db.ReferenceProperty(Author)
author_name = db.StringProperty()
title = db.StringProperty()
date = db.DateTimeProperty()
.....




Here the developer would need to maintain the author_name explicitly
whenever the referring author's name changes. Although this is not
often, and serves as a simple example, its often routine to have to
maintain some sort 'foreign property' in this manor. It would be very
powerful and encouraging to offer something like the following
descriptor for a field which can be managed through handler somewhere
in the background. Using the models above:


I think it could be very powerful to consider the following concept as
a way to ease data / relational integrity while still maintaing a sense
of denormalization.


Often times certain fields for a model may be replicated to maintain a
more embedded view of properties. This leaves the developer responsible
for its upkeep often times through db.keys / ReferenceProperties
between the model and its counterpart (relation). Would it be possible
to stream line this by specifying that a given field should be synced
to a model field; taking advantage of the backwards/forward relations
maintained by ReferenceProperties.


For example:




class Author(db.Model):
author_name = db.StringProperty()
sex = db.StringProperty()
birth_day = db.DateTimeProperty()
.....



class Story(db.Model):
author_key = db.ReferenceProperty(Author)
author_name = db.StringProperty(sync=author_key.author_name)
title = db.StringProperty()
date = db.DateTimeProperty()
.....


What happens here is that a manager handles the backwards relations for
the ReferenceProperty so that every time the related Author name
changes / its synced to its counterpart "foreign fields". I am not sure
that the (sync=author_key.author_name) is the most ideal way to specify
this / perhaps just a new Property in general such as
SyncProperty(some_key.somefield) or ForeignProperty() may be more
ideal. Regardless, this would be an amazing concept to see within the
app engine sdk. The point here is that author_name is still embed but
managed through its related reference in terms of syncing to a value
that may change.


Thanks,
Zach

-- 
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-appeng...@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