-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Is your feature request related to a problem? Please describe.
The code samples for using query parameters are a bit hard to follow because they create several temporary variables.
google-cloud-python/bigquery/docs/snippets.py
Lines 1868 to 1873 in 518931b
| query_params = [ | |
| bigquery.ScalarQueryParameter("corpus", "STRING", "romeoandjuliet"), | |
| bigquery.ScalarQueryParameter("min_word_count", "INT64", 250), | |
| ] | |
| job_config = bigquery.QueryJobConfig() | |
| job_config.query_parameters = query_params |
The code samples are still in snippets.py. Ideally these samples would be moved to the samples/ directory.
The code samples supply a location argument for queries, even though this can now be autodetected for queries in all regions.
Describe the solution you'd like
A clear and concise description of what you want to happen.
- Move any
bigquery_query_params_...samples to thesamples/directory. - Remove the
locationargument from thequery()method in the moved code samples - Use the
query_parametersargument in the constructor toQueryJobConfig(added in BigQuery: Add properties to job config constructors #6397).
job_config = bigquery.QueryJobConfig(
query_parameters=[
bigquery.ScalarQueryParameter("corpus", "STRING", "romeoandjuliet"),
bigquery.ScalarQueryParameter("min_word_count", "INT64", 250),
],
)Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
N/A
Additional context
Add any other context or screenshots about the feature request here.
Reported by customer in internal issue 143862711.