Skip to content

fix: avoid TypeError when executing DML statements with read_gbq #483

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

Merged
merged 3 commits into from
Feb 24, 2022

Conversation

tswast
Copy link
Collaborator

@tswast tswast commented Feb 22, 2022

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #481 🦕

@tswast tswast requested a review from a team as a code owner February 22, 2022 22:02
@tswast tswast requested review from a team and shollyman February 22, 2022 22:02
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-pandas API. label Feb 22, 2022
@@ -495,6 +496,11 @@ def run_query(self, query, max_results=None, progress_bar_type=None, **kwargs):
except self.http_error as ex:
self.process_http_error(ex)

# Avoid attempting to download results from DML queries, which have no
# destination.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will also impact scripts as well; do you need additional handling for that case (example: the last line in a script is a SELECT)

Copy link
Collaborator Author

@tswast tswast Feb 24, 2022

Choose a reason for hiding this comment

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

That's on the TODO list: #149 (comment)

The to_dataframe method in google-cloud-bigquery can call getQueryResults now, which should handle the scripting case. Though I'm actually not sure what happens when we try to use the BQ Storage API in google-cloud-bigquery with a script. Filed googleapis/python-bigquery#1148 to investigate this in google-cloud-bigquery.

@tswast tswast merged commit e9f0e3f into main Feb 24, 2022
@tswast tswast deleted the issue481-dml-regression branch February 24, 2022 15:26
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError(_NEED_TABLE_ARGUMENT) error using read_gbq
3 participants