-
Notifications
You must be signed in to change notification settings - Fork 6.5k
BigQuery samples using query parameters. #699
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
Conversation
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Command-line application to perform asynchronous queries in BigQuery. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add with parameters
?
wait_for_job(query_job) | ||
print('Positional parameter query completed') | ||
|
||
query_job = client.run_async_query( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do two separate sample functions instead of one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Yes, splitting into separate functions should make it a little easier to talk about in the docs I write for this, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need both sync and async? We already have a comprehensive sample on async querying, is it worthwhile to duplicate here or would a comment mentioning that you could also do this async work?
print_results(query_job.results()) | ||
|
||
|
||
def main(use_named_params=False, corpus='romeoandjuliet', min_word_count=100): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No main function, please.
@tswast a new bigquery version has been released. |
Thanks. I've updated the package and deleted the async sample. You're right. They are so similar, it's probably not worth including both. |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from sync_query_params import sync_query_named_params, sync_query_positional_params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import modules, not names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Available in latest version of google-cloud-bigquery (0.22.0), so upgrades the requirement, too.
…tform/python-docs-samples#699) Available in latest version of google-cloud-bigquery (0.22.0), so upgrades the requirement, too.
…tform/python-docs-samples#699) Available in latest version of google-cloud-bigquery (0.22.0), so upgrades the requirement, too.
…on-docs-samples#699) Available in latest version of google-cloud-bigquery (0.22.0), so upgrades the requirement, too.
This query syntax is supported in the not-yet-released version of google-cloud-python in googleapis/google-cloud-python#2776.
I've added the do not merge label, since we should wait for the next google-cloud-python release, but the sample should be ready to review.