googleapis/python-bigquery

Is there a way to refresh the token using client.query(QUERY)?

ahlag opened this issue · 1 comments

ahlag commented

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

We would like to refresh our session token, because our session only lasts for an hour, so we need to refresh it every hour.

from google.cloud import bigquery

client = bigquery.Client()

# Perform a query.
QUERY = (
    'SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` '
    'WHERE state = "TX" '
    'LIMIT 100')
query_job = client.query(QUERY)  # API request
rows = query_job.result()  # Waits for query to finish

image

Hi @ahlag, thank you for your question! As far as I know, I don't think the BigQuery package takes care of authentication. However, there is an google-api-python-client that covers OAuth, see here for this library. The documentation for OAuth can be found here. I will close this issue for now, but if you have any question, feel free to reopen it.