GithubHelp home page GithubHelp logo

Comments (12)

tylertreat avatar tylertreat commented on May 18, 2024

You can't add pycrypto as an external lib, you need to enable it on your appspot via app.yaml: https://cloud.google.com/appengine/docs/python/tools/libraries27

Note that you may need to convert the .p12 key file to a .pem to work on app engine. See this issue for more information.

That said, the recommended way to use this on App Engine is to not use a private key at all but instead to use AppAssertionCredentials.

from bigquery import get_client
from bigquery import BIGQUERY_SCOPE
from oauth2client.appengine import AppAssertionCredentials

credentials = AppAssertionCredentials(scope=BIGQUERY_SCOPE)
client = get_client('my-project', credentials=credentials)

from bigquery-python.

thinksource avatar thinksource commented on May 18, 2024

can you tell me the import password for convert my key.p12 to key.pem.
when google generate the key.p12 it do not give me password

from bigquery-python.

tylertreat avatar tylertreat commented on May 18, 2024

The password defaults to 'notasecret'

from bigquery-python.

thinksource avatar thinksource commented on May 18, 2024

Still have error :

Traceback (most recent call last):
  File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "C:\Users\sheng\PycharmProjects\helloboard\main.py", line 107, in get
    results=client.get_query_rows(job_id)
  File "C:\Users\sheng\PycharmProjects\helloboard\lib\bigquery\client.py", line 252, in get_query_rows
    limit=limit)
  File "C:\Users\sheng\PycharmProjects\helloboard\lib\bigquery\client.py", line 962, in _get_query_results
    timeoutMs=0).execute()
  File "C:\Users\sheng\PycharmProjects\helloboard\lib\apiclient\http.py", line 292, in execute
    raise HttpError(resp, content, self.uri)
HttpError: <HttpError 400 when requesting https://www.googleapis.com/bigquery/v2/projects/foretribebigquery/queries/job__xvopSV8jCsxehtLRG6lfOfe2Y0?startIndex=None&alt=json&maxResults=0&timeoutMs=0 returned "Invalid unsigned long value: 'None'.">

from bigquery-python.

tylertreat avatar tylertreat commented on May 18, 2024

Can you post the code you're using which gives this error? Looks like a bad request is happening.

from bigquery-python.

tylertreat avatar tylertreat commented on May 18, 2024

Specifically, the problem is startIndex=None.

from bigquery-python.

thinksource avatar thinksource commented on May 18, 2024

The error is 0 ms second, do you know how to set the second?
I think that is the timeoutMs=0 problem. do you know where to set this time?

INFO     2015-01-29 02:11:32,084 client.py:529] Attempting refresh to obtain initial access_token
INFO     2015-01-29 02:11:32,279 client.py:771] Refreshing access_token
INFO     2015-01-29 02:11:39,181 discovery.py:522] URL being requested: https://www.googleapis.com/bigquery/v2/projects/foretribebigquery/queries?alt=json
WARNING  2015-01-29 02:11:39,250 util.py:132] new_request() takes at most 1 positional argument (2 given)
INFO     2015-01-29 02:11:43,282 discovery.py:522] URL being requested: https://www.googleapis.com/bigquery/v2/projects/foretribebigquery/queries/job_QqtZ34Vlmz3tI3iuICFgQqeNduE?maxResults=0&alt=json&startIndex=0&timeoutMs=0
WARNING  2015-01-29 02:11:43,282 util.py:132] new_request() takes at most 1 positional argument (2 given)
INFO     2015-01-29 02:11:45,499 discovery.py:522] URL being requested: https://www.googleapis.com/bigquery/v2/projects/foretribebigquery/queries/job_QqtZ34Vlmz3tI3iuICFgQqeNduE?maxResults=0&alt=json&startIndex=None&timeoutMs=0
WARNING  2015-01-29 02:11:45,499 util.py:132] new_request() takes at most 1 positional argument (2 given)
ERROR    2015-01-29 02:11:46,950 webapp2.py:1552] <HttpError 400 when requesting https://www.googleapis.com/bigquery/v2/projects/foretribebigquery/queries/job_QqtZ34Vlmz3tI3iuICFgQqeNduE?maxResults=0&alt=json&startIndex=None&timeoutMs=0 returned "Invalid unsigned long value: 'None'.">

from bigquery-python.

thinksource avatar thinksource commented on May 18, 2024

I use the basic solution of your example:

QUERY = "SELECT * FROM [testdata.zip_code] LIMIT 1000"
class JsonHandler(webapp2.RequestHandler):

    def get(self):
        client=bigquery.get_client(project_id, service_account=service_email, private_key_file=key,  readonly=True)
        job_id, _results = client.query(QUERY)
        complete,row_count=client.check_job(job_id)
        results=client.get_query_rows(job_id)
        self.response.headers['Content-Type'] = 'application/json'
        self.response.out.write(json.dump(results))

from bigquery-python.

tylertreat avatar tylertreat commented on May 18, 2024

What happens if you try:

client.get_query_rows(job_id, offset=0)

from bigquery-python.

thinksource avatar thinksource commented on May 18, 2024

it works, but as the maxResult=0, it just give me 0 result, can you tell me how to set the maxResult variable?

from bigquery-python.

tylertreat avatar tylertreat commented on May 18, 2024

The limit kwarg should control how many results are returned.

On Wed, Jan 28, 2015, 9:07 PM thinksource [email protected] wrote:

it works, but as the maxResult=0, it just give me 0 result, can you tell
me how to set the maxResult variable?


Reply to this email directly or view it on GitHub
#43 (comment)
.

from bigquery-python.

thinksource avatar thinksource commented on May 18, 2024

Thank you it works

from bigquery-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.