FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

refactor: update insert_rows.py for more efficient streaming by jmgreger · Pull Request #212 · googleapis/python-bigquery · GitHub

This repository was archived by the owner on Mar 6, 2026. It is now read-only.
/ python-bigquery Public archive

refactor: update insert_rows.py for more efficient streaming - #212

Closed
jmgreger wants to merge 5 commits into
googleapis:masterfrom
jmgreger:patch-1
Closed

refactor: update insert_rows.py for more efficient streaming#212
jmgreger wants to merge 5 commits into
googleapis:masterfrom
jmgreger:patch-1

Conversation

jmgreger commented Aug 3, 2020

Copy link
Copy Markdown

Added in the use of selected_fields=schema to explicitly define the schema. This prevents excessive calling of table metadata when streaming large volumes of data.

There may be a better way to showcase this in the code, but I wanted to put this out there for review.

Fixes #211 🦕

jmgreger requested a review from shollyman as a code owner August 3, 2020 16:39
google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 3, 2020
HemangChothani changed the title Update insert_rows.py for more efficient streaming refactor: update insert_rows.py for more efficient streaming Aug 4, 2020
plamut added the type: docs Improvement to the documentation for an API. label Aug 4, 2020
release-please Bot requested a review from a team as a code owner August 4, 2020 16:39
release-please Bot requested review from leahecole and removed request for a team August 4, 2020 16:39

tseaver left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please rebase to remove the release-related changes from this PR (the first three commits). Oops, my bad: the issue is that your PR targets the release-v1.27.0 branch, instead of master.

tseaver added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed type: docs Improvement to the documentation for an API. labels Aug 5, 2020

Copy link
Copy Markdown
Author

Please rebase to remove the release-related changes from this PR (the first three commits). Oops, my bad: the issue is that your PR targets the release-v1.27.0 branch, instead of master.

Ahh, sorry about that. I don't submit code very often :/. Should I make a new PR against master instead?

jmgreger changed the base branch from release-v1.27.0 to master August 11, 2020 02:33
jmgreger requested a review from tseaver August 11, 2020 02:36

Copy link
Copy Markdown
Author

I re-based this off of the master branch, now it just needs the files added by the chore bot to be removed. Doesn't look like I have rights to do that though.

tseaver commented Aug 11, 2020

Copy link
Copy Markdown
Contributor

@jmgreger If you use git rebase -i in your local clone, you should be able to delete the bot-generated commits. E.g.:

$ git checkout master
$ git fetch --all upstream  #  assuming this repo's remote is named 'upstream'.
$ git pull upstream/master
$ git checkout patch-1
$ git rebase -i master  # delete first three commits and the last merge commit
$ git push -f origin patch-1

As an alternative, you could just cherry-pick the patch from this commit into a new branch against current master, and then submit a new PR from that branch.

product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Aug 21, 2020
rows_to_insert = [(u"Phred Phlyntstone", 32), (u"Wylma Phlyntstone", 29)] #populate data for entry

try:
if 'schema' not in globals():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please keep the sample simple. This is unnecessary branching. If anything, we can call out that the schema can be fetched from a table in a comment.

Comment thread samples/table_insert_rows.py Outdated
client.insert_rows(table_id, selected_fields=schema, rows_to_insert) # Stream data to BQ
print("New rows have been added.")
except ValueError:
print("Table’s schema is not set or rows is not a Sequence.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No need to catch this ValueError. Just let the exception bubble up.

Copy link
Copy Markdown
Contributor

LGTM once Tim's comments are addressed and as long as tests pass

jmgreger and others added 4 commits August 31, 2020 15:52
Added in the use of selected_fields=schema to explicitly define the schema. This prevents excessive calling of table metadata when streaming large volumes of data.

There may be a better way to showcase this in the code, but I wanted to put this out there for review.
…eapis#208)

Co-authored-by: Tres Seaver <tseaver@palladion.com>
Co-authored-by: Takashi Matsuo <tmatsuo@google.com>

google-cla Bot commented Aug 31, 2020

Copy link
Copy Markdown

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

google-cla Bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Aug 31, 2020
Co-authored-by: Tim Swast <swast@google.com>

google-cla Bot commented Aug 31, 2020

Copy link
Copy Markdown

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

plamut commented Sep 1, 2020

Copy link
Copy Markdown
Contributor

Closing this in favor of #253 as per comment in that PR.

plamut closed this Sep 1, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. cla: no This human has *not* signed the Contributor License Agreement. do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve guidance for streaming inserts

6 participants


Back | FazBrowse Home | New Git URL