Reputation: 73
I have a class that runs as a cron job (every 5 minutes or so) and it produces a multidimensional array. I then want to access this array from another class.
Is it possible to just put() a whole md-array as a single object into the datastore? And then to get() that md-array in another class?
If so, is it similar to just putting other simple variables into the datastore?
Cheers for any help
Upvotes: 2
Views: 1304
Reputation: 41347
No, you cannot directly store a multi-dimensional array as a property of a datastore entity. The closest type would be a (Python only, not for Java)ListProperty
, but this will only store one dimension.
Depending on what the data in your md-array represents, you could:
Serialize the values into a byte array, which you store as a Blob
(1 MB size limit)
Flatten the array and store each dimension as an individual property
Create an entity for the rows, and properties for the columns (if 2-dimensional)
For all supported datastore property types, see this section of the GAE documentation
Upvotes: 2