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

feat(datastore): Add Datastore Admin API samples #4121

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
use backoff instead of retrying, add App Engine tip
  • Loading branch information
IlyaFaer committed Jul 1, 2020
commit b447a3605ca297896bfa9e7a5db33d10615d3169
5 changes: 3 additions & 2 deletions datastore/cloud-client/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ This directory contains samples for Google Cloud Datastore. `Google Cloud Datast
.. _Google Cloud Datastore: https://cloud.google.com/datastore/docs


To run the sample, you need to have `Datastore Import Export Admin` role.


Set environment variables:
`GOOGLE_CLOUD_PROJECT` - Google Cloud project id
`CLOUD_STORAGE_BUCKET` - Google Cloud Storage bucket name

For entities import/export you also need a `Storage Admin`, or `Storage Owner` role set in your Service Account.
Roles to be set in your Service Account and App Engine default service account:
`Datastore Import Export Admin`, or `Cloud Datastore Owner`, or `Owner`
`Storage Admin`, or `Owner`


Setup
Expand Down
6 changes: 3 additions & 3 deletions datastore/cloud-client/README.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ product:
`Google Cloud Datastore`_ is a NoSQL document database built for automatic
scaling, high performance, and ease of application development.

required_role: Datastore Import Export Admin
other_required_steps: >
Set environment variables:
IlyaFaer marked this conversation as resolved.
Show resolved Hide resolved
`GOOGLE_CLOUD_PROJECT` - Google Cloud project id
`CLOUD_STORAGE_BUCKET` - Google Cloud Storage bucket name

For entities import/export you also need a `Storage Admin`, or
`Storage Owner` role set in your Service Account.
Roles to be set in your Service Account and App Engine default service account:
`Datastore Import Export Admin`, or `Cloud Datastore Owner`, or `Owner`
`Storage Admin`, or `Owner`

setup:
- auth
Expand Down
4 changes: 2 additions & 2 deletions datastore/cloud-client/admin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import admin
import pytest
from retrying import retry
import backoff


PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"]
Expand All @@ -39,7 +39,7 @@ def test_get_index(self):
def test_list_index(self):
assert admin.list_indexes(PROJECT)

@retry(stop_max_attempt_number=3, stop_max_delay=540000)
@backoff.on_exception(backoff.expo, AssertionError, max_tries=3, max_time=540000)
def test_export_import_entities(self):
response = admin.export_entities(PROJECT, "gs://" + BUCKET)
assert response
Expand Down