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

BigQuery samples using query parameters. #699

Merged
merged 1 commit into from
Dec 6, 2016
Merged

BigQuery samples using query parameters. #699

merged 1 commit into from
Dec 6, 2016

Conversation

tswast
Copy link
Contributor

@tswast tswast commented Dec 5, 2016

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.

@tswast tswast added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Dec 5, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 5, 2016
# See the License for the specific language governing permissions and
# limitations under the License.

"""Command-line application to perform asynchronous queries in BigQuery.
Copy link
Contributor

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(
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@theacodes theacodes left a 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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No main function, please.

@theacodes
Copy link
Contributor

@tswast a new bigquery version has been released.

@tswast tswast changed the title [DO NOT MERGE] BigQuery samples using query parameters. BigQuery samples using query parameters. Dec 6, 2016
@tswast tswast removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Dec 6, 2016
@tswast
Copy link
Contributor Author

tswast commented Dec 6, 2016

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import modules, not names.

Copy link
Contributor Author

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.
@theacodes theacodes merged commit 704c564 into master Dec 6, 2016
@theacodes theacodes deleted the tswast-bq branch December 6, 2016 23:01
plamut pushed a commit to plamut/python-bigquery that referenced this pull request Jun 25, 2020
…tform/python-docs-samples#699)

Available in latest version of google-cloud-bigquery (0.22.0), so
upgrades the requirement, too.
plamut pushed a commit to plamut/python-bigquery that referenced this pull request Jul 22, 2020
…tform/python-docs-samples#699)

Available in latest version of google-cloud-bigquery (0.22.0), so
upgrades the requirement, too.
shollyman pushed a commit to googleapis/python-bigquery that referenced this pull request Jul 22, 2020
…on-docs-samples#699)

Available in latest version of google-cloud-bigquery (0.22.0), so
upgrades the requirement, too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants