Question - does GAE zip db.Blob or db.Text data when it puts it in the
datastore? If so, there's no point in me doing so and there may not
be any point in my using binary-format pickle.
I've definined a couple of custom properties, PickleProperty and
JSONProperty, both with an instance-specific zipped storage option.
When option determines whether get_value_for_datastore for a given
instance of these properties will zip the pickle or the JSON format
data. (For pickle, there's also the binary vs plaintext decision.)
Yes, I do need to experiment with the combinations of pickle binary
and zipping. I expect that JSON will zip quite well. I also need to
figure out whether zipping buys me anything.
However, assuming that zipping and/or pickle binary format is
worthwhile, there are circumstances when I'd rather not use it and
those circumstances are not amenable to expando or even different
property instances.
The most important use case is probably program development. When I'm
comfortable with how things are working wrt a given property instance,
I'll store zipped and/or pickle-binary data in db.Blob format in the
datastore. However, when I'm not, I'll store "plaintext" in db.Text
format in the datastore so I can more look at newly stored data for
said instance with the console.
Since I don't want to rebuild the datastore wrt said property
instances between "comfortable" and "uncomfortable", I'd like the
datastore to contain data in both formats for a given property
instance.
Thanks for your help,
-andy
On Nov 17, 2:12 pm, Marzia Niccolai <[EMAIL PROTECTED]> wrote:
> Hi Andy,
>
> It's possible you could do this (though not using the code below), but it
> seems like it would be easier to just use a db.Expando model? I can't see
> any advantages to consistently having the same property name use two
> different types.
>
> -Marzia
>
>
>
> On Mon, Nov 17, 2008 at 12:56 PM, Andy Freeman <[EMAIL PROTECTED]> wrote:
>
> > Since neither db.Text nor db.Blob is indexed, can we decide between
> > them on an entity-specific basis?
>
> > Specifically:
>
> > class A(db.Model):
> > a = CustomProperty()
>
> > # where CustomProperty takes its data_type for get_value_for_datastore
> > purposes from the value, not from CustomProperty's definition.
>
> > a1 = A()
> > a1.a = db.Text('hi')
> > a1.put()
> > a2 = A()
> > a2.a = db.Blob('there')
> > a2.put()
>
> > Will the datastore have some problem with the fact that a1's a
> > property db.Text while a2's a property is db.Blob?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---