-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: Fix error when query job destination is None #3127
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,9 +194,14 @@ def execute_sql( | |
| connection_properties=bq_connection_properties, | ||
| ), | ||
| ) | ||
| destination_dataset_id = None | ||
| if dry_run_query_job.destination: | ||
| destination_dataset_id = dry_run_query_job.destination.dataset_id | ||
|
|
||
| if ( | ||
| dry_run_query_job.statement_type != "SELECT" | ||
| and dry_run_query_job.destination.dataset_id != bq_session_dataset_id | ||
| and destination_dataset_id != bq_session_dataset_id | ||
| and destination_dataset_id is not None | ||
| ): | ||
|
Comment on lines
+197
to
205
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While the current implementation correctly fixes the bug, it can be simplified for better readability and conciseness. By leveraging Python's short-circuiting behavior with if ( dry_run_query_job.statement_type != "SELECT" and dry_run_query_job.destination and dry_run_query_job.destination.dataset_id != bq_session_dataset_id ): |
||
| return { | ||
| "status": "ERROR", | ||
|
|
||