GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Python to construct CASE WHEN update SQL statement · Issue #970 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Python to construct CASE WHEN update SQL statement #970

Copy link
Copy link
Closed
#974
Closed
Python to construct CASE WHEN update SQL statement#970
#974
Copy link
Assignees
tswast
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@elad2109
elad2109
opened on Sep 14, 2021
Issue body actions

I try to update 2K rows in BQ

def update_bq_ads_status_failed(self, update_ads):
        affected_rows = 0
        for update_ads_chunk in split(update_ads, _UPDATE_CHUNK_SIZE):
            ad_ids = [item["ad_id"] for item in update_ads_chunk]
            removal_errors = [item["removal_error"] for item in update_ads_chunk]

            update_removal_error = ""
            for ad_id, removal_error in zip(ad_ids, removal_errors):
                update_removal_error = update_removal_error + \
                                       f''' WHEN ad_id = '{ad_id}' Then '{removal_error}' '''
            affected_rows += self.update_bq_ads_status(f"""
                            UPDATE '{table_full_name}' 
                            SET status = 'Failed Removing'  
                SET removal_error = CASE {update_removal_error} END 
                WHERE ad_id IN {str(ad_ids)}
                """)
        return affected_rows

I'm getting this error. I know it's too vague and not possible to debug like this.

timeout=300.0, headers={'X-Server-Timeout': '300.0',
'Accept-Encoding': 'gzip', 'Content-Type': 'application/json',
'X-Goog-API-Client': 'gl-python/3.8.10 grpc/1.39.0 gax/2.0.0
gapic/2.26.0 gccl/2.26.0', 'User-Agent': 'gl-python/3.8.10 grpc/1.39.0
gax/2.0.0 gapic/2.26.0 gccl/2.26.0'})), last exception: ('Connection
aborted.', RemoteDisconnected('Remote end closed connection without
response'))

I'm trying to eliminate errors. Is my BQ update syntactically correct?

What's the BQ update timeout?

Activity

  1. JustinBeckwith
    transferred this issue fromgoogleapis/google-cloud-nodeon Sep 14, 2021
  2. busunkim96 commented on Sep 14, 2021

    @busunkim96
    busunkim96
    on Sep 14, 2021
    Contributor
    More actions

    It looks like the library version in x-goog-api-client is 2.26.0, which is the latest version of [google-cloud-bigquery](https://pypi.org/project/google-cloud-bigquery/. The latest release of google-api-python-client is 2.20.0.

    @elad2109 Could you confirm which library you are using (google-api-python-client or google-cloud-bigquery?

  3. busunkim96
    transferred this issue fromgoogleapis/google-api-python-clienton Sep 14, 2021
  4. product-auto-label
    added
    api: bigqueryIssues related to the googleapis/python-bigquery API.
    on Sep 14, 2021
  5. elad2109 commented on Sep 14, 2021

    @elad2109
    elad2109
    on Sep 14, 2021
    Author
    More actions

    It looks like the library version in x-goog-api-client is 2.26.0, which is the latest version of [google-cloud-bigquery](https://pypi.org/project/google-cloud-bigquery/. The latest release of google-api-python-client is 2.20.0.

    @elad2109 Could you confirm which library you are using (google-api-python-client or google-cloud-bigquery?

    Sorry for asking, is there any easy way cmd to run to verify?

  6. busunkim96 commented on Sep 14, 2021

    @busunkim96
    busunkim96
    on Sep 14, 2021
    Contributor
    More actions

    @elad2109 Ah no worries, a pip freeze (assuming you're using pip) will show the packages you currently have installed.

    Alternatively, you can check the imports in your code:
    from google.cloud import bigquery for google-cloud-bigquery

    from googleapiclient import discovery for google-api-python-client

  7. elad2109 commented on Sep 15, 2021

    @elad2109
    elad2109
    on Sep 15, 2021
    Author
    More actions

    My code has from google.cloud import bigquery

  8. meredithslota
    added
    type: questionRequest for information or clarification. Not an issue.
    on Sep 16, 2021
  9. tswast
    added
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    and removed
    type: questionRequest for information or clarification. Not an issue.
    on Sep 17, 2021
  10. tswast
    self-assigned this
    on Sep 17, 2021
  11. tswast commented on Sep 17, 2021

    @tswast
    tswast
    on Sep 17, 2021
    Contributor
    More actions

    It looks like the default timeout of 5 minutes (60 * 5 seconds) might not be long enough. The default timeout was added in #896 in response to a request from the backend engineering folks.

    It seems to me we should remove the default timeout, though the logic to add the X-Server-Timeout header if a timeout is explicitly set should remain.

  12. gcf-merge-on-green
    closed this as completedin #974on Sep 21, 2021
  13. gcf-merge-on-green
    added a commit that references this issue on Sep 21, 2021

    fix: remove default timeout (#974)

    This issue will close once commit 1cef0d4 is merged into the 'main' branch.
    1cef0d4
  14. abdelmegahedgoogle
    added a commit that references this issue on Apr 17, 2023

    fix: remove default timeout (googleapis#974)

    This issue will close once commit f1a2353 is merged into the 'main' branch.
    f1a2353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tswast
    tswast

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.