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

Conversation

elibixby
Copy link
Contributor

No description provided.

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?

@jeffmendoza
Copy link
Contributor

What is the strategy with the READMEs?

@elibixby
Copy link
Contributor Author

I think we should put information in the highest directory such that it applies to all subdirectories. This way we avoid duplication, which is the purpose of these changes (just moved two identical files into their shared parent).

@jeffmendoza
Copy link
Contributor

Cool, sounds good

@jeffmendoza
Copy link
Contributor

more Squashage

credentials = GoogleCredentials.get_application_default()
if credentials.create_scoped_required():
credentials = credentials.create_scoped('https://www.googleapis.com/auth/bigquery')
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

@SurferJeffAtGoogle
Copy link
Contributor

My prior errors were due to the fact that I clicked the "Google internal-only" box when I created the project.

Now I'm seeing this error:
cover runtests: PYTHONHASHSEED='3998625439'
cover runtests: commands[0] | nosetests --with-gae --with-xunit --with-xcoverage --cover-tests --cover-branches --cover-min-percentage=70 --cover-inclusive --cover-erase

...E...S..................

ERROR: test_stream_row_to_bigquery (bigquery.tests.test_streaming.TestStreaming)

Traceback (most recent call last):
File "/usr/local/google/home/rennie/gitrepos/python-docs-samples/bigquery/tests/test_streaming.py", line 37, in test_stream_row_to_bigquery
5):
File "/usr/local/google/home/rennie/gitrepos/python-docs-samples/bigquery/samples/streaming.py", line 53, in run
num_retries)
File "/usr/local/google/home/rennie/gitrepos/python-docs-samples/bigquery/samples/streaming.py", line 40, in stream_row_to_bigquery
body=insert_all_data).execute(num_retries=num_retries)
File "/usr/local/google/home/rennie/google-cloud-sdk/platform/google_appengine/lib/oauth2client/oauth2client/util.py", line 129, in positional_wrapper
return wrapped(_args, *_kwargs)
File "/usr/local/google/home/rennie/gitrepos/python-docs-samples/.tox/cover/local/lib/python2.7/site-packages/googleapiclient/http.py", line 729, in execute
raise HttpError(resp, content, uri=self.uri)
HttpError: <HttpError 404 when requesting https://www.googleapis.com/bigquery/v2/projects/surferjeff-test2/datasets/test_dataset/tables/test_table2/insertAll?alt=json returned "Not found: Dataset surferjeff-test2:test_dataset">
-------------------- >> begin captured logging << --------------------
googleapiclient.discovery: INFO: URL being requested: GET https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest
googleapiclient.discovery: INFO: URL being requested: POST https://www.googleapis.com/bigquery/v2/projects/surferjeff-test2/datasets/test_dataset/tables/test_table2/insertAll?alt=json
oauth2client.client: INFO: Attempting refresh to obtain initial access_token
oauth2client.client: INFO: Refreshing access_token
--------------------- >> end captured logging << ---------------------

@tmatsuo
Copy link
Contributor

tmatsuo commented May 22, 2015

@SurferJeffAtGoogle
Yep, I also encountered this error.
I found that, in order to use your own project for the test, you need to create dataset and table defined in the constants file.

Ideally, the test setup should be able to take care of them.
At least, we should update the README for how to run the tests.

@elibixby
Copy link
Contributor Author

closed to merge from branch.

@elibixby elibixby closed this May 22, 2015
donmccasland pushed a commit that referenced this pull request Nov 8, 2022
* docs: add long timeout code snippet

* fix lint

* add timeout
dandhlee pushed a commit that referenced this pull request Nov 9, 2022
* docs: add long timeout code snippet

* fix lint

* add timeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants