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

Updated Caching #20

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 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
8 changes: 6 additions & 2 deletions bigquery/samples/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@

# [START get_service]
def get_service():
from discovery_doc import build_and_update
return build_and_update('bigquery', 'v2')
from googleapiclient.discovery import build_from_document
from oauth2client.client import GoogleCredentials
credentials = GoogleCredentials.get_application_default()
if credentials.create_scoped_required():
credentials = credentials.create_scoped('https://www.googleapis.com/auth/bigquery')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is create_scoped required here?

return build('bigquery','v2', credentials=GoogleCredentials.get_application_default())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run tox, I get this error:
(python-docs-samples)rennie@rennie:~/gitrepos/python-docs-samples$ tox
py27-nosetest installed: Flask==0.10.1,google-api-python-client==1.4.0,httplib2==0.9.1,itsdangerous==0.24,Jinja2==2.7.3,MarkupSafe==0.23,mock==1.0.1,nose==1.3.6,NoseGAE==0.5.7,oauth2client==1.4.11,pyasn1==0.1.7,pyasn1-modules==0.0.5,rsa==3.1.4,simplejson==3.7.1,six==1.9.0,uritemplate==0.6,Werkzeug==0.10.4
py27-nosetest runtests: PYTHONHASHSEED='4074483713'
py27-nosetest runtests: commands[0] | nosetests --with-gae

EEEEE..S.................

ERROR: test_async_query (bigquery.test.test_async_query.TestAsyncQuery)

Traceback (most recent call last):
File "/usr/local/google/home/rennie/gitrepos/python-docs-samples/bigquery/test/test_async_query.py", line 28, in test_async_query
5):
File "/usr/local/google/home/rennie/gitrepos/python-docs-samples/bigquery/samples/async_query.py", line 48, in run
service = get_service()
File "/usr/local/google/home/rennie/gitrepos/python-docs-samples/bigquery/samples/utils.py", line 23, in get_service
return build('bigquery','v2', credentials=GoogleCredentials.get_application_default())
NameError: global name 'build' is not defined

# [END get_service]


Expand Down
59 changes: 56 additions & 3 deletions datastore/ndb/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
appengine-ndb-snippets
======================
## NDB Overview Sample

Sample code snippets for NDB.
This is a sample app for Google App Engine that exercises the [NDB Python API](https://cloud.google.com/appengine/docs/python/ndb/).

See our other [Google Cloud Platform github
repos](https://github.com/GoogleCloudPlatform) for sample applications and
scaffolding for other python frameworks and use cases.

## Run Locally
1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/), including the [gcloud tool](https://cloud.google.com/sdk/gcloud/), and [gcloud app component](https://cloud.google.com/sdk/gcloud-app).
2. Setup the gcloud tool.

```
gcloud components update app
gcloud auth login
gcloud config set project <your-app-id>
```
You don't need a valid app-id to run locally, but will need a valid id to deploy below.

1. Clone this repo.

```
git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
cd python-docs-samples/datastore/ndb/<sub-directory>
```

1. Run this project locally from the command line.

```
gcloud preview app run ./
```

1. Visit the application at [http://localhost:8080](http://localhost:8080).

## Deploying

1. Use the [Cloud Developer Console](https://console.developer.google.com) to create a project/app id. (App id and project id are identical)
2. Configure gcloud with your app id.

```
gcloud config set project <your-app-id>
```
1. Use the [Admin Console](https://appengine.google.com) to view data, queues, and other App Engine specific administration tasks.
1. Use gcloud to deploy your app.

```
gcloud preview app deploy ./
```

1. Congratulations! Your application is now live at your-app-id.appspot.com

## Contributing changes

* See [CONTRIBUTING.md](../../CONTRIBUTING.md)

## Licensing

* See [LICENSE](../../LICENSE)
57 changes: 0 additions & 57 deletions datastore/ndb/overview/README.md

This file was deleted.

61 changes: 0 additions & 61 deletions datastore/ndb/transactions/README.md

This file was deleted.

File renamed without changes.