Created
January 30, 2014 20:41
-
-
Save proppy/8718248 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from gcloud import datastore | |
>>> dataset = datastore.dataset('foo') | |
>>> entity = dataset.entity('Foo', 1) # complete key | |
>>> entity.key | |
('Foo', 1L) | |
>>> entity.save() # or dataset.upsert(entity) | |
>>> entity = dataset.entity('Foo') # incomplete key | |
>>> entity.key | |
('Foo',) | |
>>> entity.save() # or dataset.upsert(entity) | |
>>> entity.key | |
('Foo', 1001L) # auto allocated ids | |
>>> entity = dataset.entity('Parent', 'name', 'Foo', 2) | |
>>> entity.key | |
('Parent', 'name', 'Foo', 2) | |
>>> entity.save() # or dataset.upsert(entity) | |
>>> dataset.lookup([('Parent', 'name', 'Foo', 2), ('Foo', 1)]) | |
[Entity('Parent', 'name', 'Foo', 2), ('Foo', 1)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(Adding a back-reference: googleapis/google-cloud-python#3)