Skip to content

Commit

Permalink
Uses 'category' instead of 'type' as a property name (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterHub authored and Jon Wayne Parrott committed Aug 16, 2016
1 parent 3618dce commit 6ef9960
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
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

0 comments on commit 6ef9960

Please sign in to comment.