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

feat: map "if_exists" value to LoadJobConfig.WriteDisposition #583

Merged
merged 61 commits into from Nov 7, 2022

Conversation

aribray
Copy link
Contributor

@aribray aribray commented Oct 27, 2022

Use LoadJobConfig.WriteDisposition to replace if_exists='fail'/'replace'/'append' behavior in to_gbq()

The WriteDisposition value specifies the action that occurs if destination table already exists.

  • if_exists="fail" ----> write_disposition="WRITE_EMPTY"
  • if_exists="append" ----> write_disposition="WRITE_APPEND"
  • if_exists="replace" ----> write_disposition="WRITE_TRUNCATE"

By using WriteDisposition, we can move away from the delete_and_recreate_table() behavior

Fixes #118 #43 #453

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigquery Issues related to the googleapis/python-bigquery-pandas API. labels Oct 27, 2022
@aribray aribray changed the title Aribray to gbq feat: map "if_exists" value to LoadJobConfig.WriteDisposition Oct 27, 2022
@aribray aribray added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 30, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 30, 2022
@aribray aribray added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 30, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 30, 2022
@aribray aribray added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 30, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 30, 2022
@aribray aribray marked this pull request as ready for review October 30, 2022 03:16
@aribray aribray requested a review from a team as a code owner October 30, 2022 03:16
@aribray aribray requested review from a team, prash-mi and tswast October 30, 2022 03:16
@aribray aribray added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 30, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 30, 2022
@aribray
Copy link
Contributor Author

aribray commented Oct 31, 2022

@tswast are the version bumps/PR description added to the Changelog automatically?

@tswast
Copy link
Collaborator

tswast commented Oct 31, 2022

@tswast are the version bumps/PR description added to the Changelog automatically?

No, that needs to be included in the commit message when we 'squash and merge'. See: https://github.com/googleapis/release-please#what-if-my-pr-contains-multiple-fixes-or-features

@aribray aribray requested a review from rosiezou November 2, 2022 15:43
Copy link

@shollyman shollyman left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together. Switching to leveraging write disposition cleans things up nicely.

pandas_gbq/gbq.py Show resolved Hide resolved
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-pandas API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLN: Use WriteDisposition for if_exists=fail/replace/append behavior in to_gbq
4 participants