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 — Job retry solution (client.create_job) is broken · Issue #297 · 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.

Job retry solution (client.create_job) is broken #297

Copy link
Copy link
Closed
#300
Closed
Job retry solution (client.create_job) is broken#297
#300
Copy link
Assignees
HemangChothani
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@bhtucker
bhtucker
opened on Oct 5, 2020
Issue body actions

A solution was implemented in #71 but is now broken.

This is not caught by unit tests because the failure is within a mocked interface.

Original issue: #14

Environment details

  • Linux
  • Python 3.6, 3.7
  • Client version 1.25 - 2.0.0

Steps to reproduce

Run the code in the unit tests without mocks; rather than failing for nonexistent/unauthorized project/dataset (as you would expect), it fails with an AttributeError.:

Code example

configuration = {
            "load": {
                "destinationTable": {
                    "projectId": 'anyproject',
                    "datasetId": 'anydataset',
                    "tableId": "source_table",
                },
                "sourceUris": ["gs://test_bucket/src_object*"],
            }
        }

bqclient.create_job(configuration)

Stack trace

Fails with:

~/python/lib/python3.7/site-packages/google/cloud/bigquery/client.py in create_job(self, job_config, retry)
   1619             source_uris = _get_sub_prop(job_config, ["load", "sourceUris"])
   1620             return self.load_table_from_uri(
-> 1621                 source_uris, destination, job_config=load_job_config, retry=retry
   1622             )
   1623         elif "copy" in job_config:

~/python/lib/python3.7/site-packages/google/cloud/bigquery/client.py in load_table_from_uri(self, source_uris, destination, job_id, job_id_prefix, location, project, job_config, retry, timeout)
   1967 
   1968         load_job = job.LoadJob(job_ref, source_uris, destination, self, job_config)
-> 1969         load_job._begin(retry=retry, timeout=timeout)
   1970 
   1971         return load_job

~/python/lib/python3.7/site-packages/google/cloud/bigquery/job.py in _begin(self, client, retry, timeout)
    643             method="POST",
    644             path=path,
--> 645             data=self.to_api_repr(),
    646             timeout=timeout,
    647         )

~/python/lib/python3.7/site-packages/google/cloud/bigquery/job.py in to_api_repr(self)
   1694             )
   1695         _helpers._set_sub_prop(
-> 1696             configuration, ["load", "destinationTable"], self.destination.to_api_repr()
   1697         )
   1698 

AttributeError: 'dict' object has no attribute 'to_api_repr'

As you can see here, the mocked client method load_table_from_uri is where the traceback begins.

The destination must be coerced to a TableRef before calling this method.

Activity

  1. product-auto-label
    added
    api: bigqueryIssues related to the googleapis/python-bigquery API.
    on Oct 5, 2020
  2. HemangChothani
    self-assigned this
    on Oct 6, 2020
  3. HemangChothani
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Oct 6, 2020
  4. yoshi-automation
    added
    triage meI really want to be triaged.
    and removed
    triage meI really want to be triaged.
    on Oct 6, 2020
  5. tswast
    closed this as completedin #300on Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @HemangChothani
    HemangChothani

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in 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.