Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes property name #455

Merged
merged 1 commit into from
Aug 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datastore/api/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ indexes:
- name: created
- kind: Task
properties:
- name: type
- name: category
- name: priority
- kind: Task
properties:
Expand Down
28 changes: 14 additions & 14 deletions datastore/api/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def basic_entity(client):
# [START basic_entity]
task = datastore.Entity(client.key('Task'))
task.update({
'type': 'Personal',
'category': 'Personal',
'done': False,
'priority': 4,
'description': 'Learn Cloud Datastore'
Expand All @@ -80,7 +80,7 @@ def entity_with_parent(client):
task = datastore.Entity(key=key_with_parent)

task.update({
'type': 'Personal',
'category': 'Personal',
'done': False,
'priority': 4,
'description': 'Learn Cloud Datastore'
Expand All @@ -97,7 +97,7 @@ def properties(client):
key,
exclude_from_indexes=['description'])
task.update({
'type': 'Personal',
'category': 'Personal',
'description': 'Learn Cloud Datastore',
'created': datetime.datetime.utcnow(),
'done': False,
Expand Down Expand Up @@ -135,7 +135,7 @@ def upsert(client):
task = datastore.Entity(key=complete_key)

task.update({
'type': 'Personal',
'category': 'Personal',
'done': False,
'priority': 4,
'description': 'Learn Cloud Datastore'
Expand All @@ -155,7 +155,7 @@ def insert(client):
task = datastore.Entity(key=incomplete_key)

task.update({
'type': 'Personal',
'category': 'Personal',
'done': False,
'priority': 4,
'description': 'Learn Cloud Datastore'
Expand Down Expand Up @@ -212,7 +212,7 @@ def batch_upsert(client):
task1 = datastore.Entity(client.key('Task', 1))

task1.update({
'type': 'Personal',
'category': 'Personal',
'done': False,
'priority': 4,
'description': 'Learn Cloud Datastore'
Expand All @@ -221,7 +221,7 @@ def batch_upsert(client):
task2 = datastore.Entity(client.key('Task', 2))

task2.update({
'type': 'Work',
'category': 'Work',
'done': False,
'priority': 8,
'description': 'Integrate Cloud Datastore'
Expand Down Expand Up @@ -296,7 +296,7 @@ def projection_query(client):
# Create the entity that we're going to query.
task = datastore.Entity(client.key('Task'))
task.update({
'type': 'Personal',
'category': 'Personal',
'done': False,
'priority': 4,
'description': 'Learn Cloud Datastore',
Expand Down Expand Up @@ -325,7 +325,7 @@ def ancestor_query(client):
task = datastore.Entity(
client.key('TaskList', 'default', 'Task'))
task.update({
'type': 'Personal',
'category': 'Personal',
'description': 'Learn Cloud Datastore',
})
client.put(task)
Expand Down Expand Up @@ -477,9 +477,9 @@ def distinct_query(client):

# [START distinct_query]
query = client.query(kind='Task')
query.distinct_on = ['type', 'priority']
query.order = ['type', 'priority']
query.projection = ['type', 'priority']
query.distinct_on = ['category', 'priority']
query.order = ['category', 'priority']
query.projection = ['category', 'priority']
# [END distinct_query]

return list(query.fetch())
Expand All @@ -491,8 +491,8 @@ def distinct_on_query(client):

# [START distinct_on_query]
query = client.query(kind='Task')
query.distinct_on = ['type']
query.order = ['type', 'priority']
query.distinct_on = ['category']
query.order = ['category', 'priority']
# [END distinct_on_query]

return list(query.fetch())
Expand Down