Reputation: 313
I have this python code snippet for adding a new entity from Google Compute Engine. But this code results in userId being created with an undefined type. How can I specify the type of the property when it is getting created from compute engine?
kg = datastore.Entity(key)
try:
kg.update({
'userId': userId,
})
client.put(kg)
Upvotes: 0
Views: 223
Reputation: 2927
gloud-python
will infer the type of the property from the type of the value you place in the property map.
https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/datastore/helpers.py#L303
Upvotes: 2