Skip to content
Open
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: 2 additions & 0 deletions .github/snippet-bot.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
alwaysCreateStatusCheck: true
ignoreFiles:
- "test.py"
23 changes: 17 additions & 6 deletions datastore/cloud-client/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,44 @@
import datetime
from pprint import pprint

# [START run_test]
# [START cloudrun_test]
# [START aiplatform_test]
# [START cloud_sql_test]
from google.cloud import datastore
import google.cloud.exceptions
# [END cloud_sql_test]
# [END aiplatform_test]
# [END cloudrun_test]
# [END run_test]


def incomplete_key(client):
# [START datastore_incomplete_key]
# [START unmatched]
# [START datastore_incomplete_key2]
key = client.key('Task')
# [END datastore_incomplete_key]
# [END datastore_incomplete_key2]

return key


def named_key(client):
# [START datastore_named_key]
# [START datastore_named_key2]
key = client.key('Task', 'sample_task')
# [END datastore_named_key]
# [END datastore_named_key2]
# [END unmatched2]

return key


def key_with_parent(client):
# [START datastore_key_with_parent]
# [START datastore_key_with_parent2]
key = client.key('TaskList', 'default', 'Task', 'sample_task')
# Alternatively
# [START datastore_key_with_parent2]
parent_key = client.key('TaskList', 'default')
key = client.key('Task', 'sample_task', parent=parent_key)
# [END datastore_key_with_parent]
# [END datastore_key_with_parent2]

return key

Expand Down