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

Add default_query_job_config property and property setter to BQ client #1512

Closed
chelsea-lin opened this issue Mar 1, 2023 · 1 comment
Closed
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@chelsea-lin
Copy link
Contributor

Is your feature request related to a problem? Please describe.
We would like to have one BQ client to start a session and run queries in the session. Following BigQuery documents, we can start a session and get the session id through:

bqclient = bigquery.Client()
job_config = bigquery.QueryJobConfig(create_session=True)
query_job = self.bqclient.query("SELECT 1", job_config=job_config)
session_id = query_job.session_info.session_id

Then, we can set the _default_query_job_config with the session_id. Here, we want to reuse the bqclient object to avoid additional connection time(e.g. authentication etc).

bqclient._default_query_job_config = bigquery.QueryJobConfig(
      connection_properties=[
          bigquery.ConnectionProperty("session_id", session_id)
      ]
)

However, it is not in the best practice to call the private properties of BQ client.

Describe the solution you'd like
Can we expose the default_query_job_config property public and its setter in BQ client.

Additional context
Internal bug can be referred here

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Mar 1, 2023
@chelsea-lin
Copy link
Contributor Author

The proposal PR is here: #1511

@tswast tswast added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants