开发者

Is it possible to decode property class from metadata _property_

When i make a meta query to ret开发者_StackOverflow中文版rieve entity properties (columns), i retrieve only this:

Kind: property ID: 0 Name: propDate property_representation = INT64

i have no enough info to map this property to a java.util.Date class because INT64 can be java.lang.Byte, java.lang.Short, java.lang.Integer, java.lang.Long

In the gae console/datastore viewer, i see that the date is formatted ... has it been decoded from metadata or from data ?

any idea !?


The App Engine datastore is schemaless. Your metadata queries return information about the properties that are indexed, but know nothing about the actual data in your entities. You can actually have entities of the same Kind that have different types for the same property name, and if these types have the same underlying representation, they'll be indistinguishable in the metadata. You'll notice in the datastore viewer that the columns in the view table (which should not be thought of as "columns" in the RDBMS sense) are not labelled with types. This isn't just a UI choice; it's because there inherently is no type for a property name at that level.

The actual datastore types for each property within an entity are stored with the entity in the protocol buffer. These aren't Java (or Python) types, but things like "atom:category", "georss:point", "gd:when", etc. (and, of course, more familiar "int", "float", "string"), and can be shown in the datastore viewer for individual entities because they've actually been deserialized. In Java and Python code, these are mapped by your application via the datastore API to Java and Python types. But there's no sense in which the data as stored in the datastore "is" a java.util.Date; it's stored as gd.when and can be read from the same datastore as a Python datetime.date.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜