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

Creating a load job in a project other than the client's project results in error #473

Closed
tchang-f5 opened this issue Jan 18, 2021 · 1 comment · Fixed by #482
Closed
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tchang-f5
Copy link

The following code

    bq_client = bigquery.Client("project_A")
    job = bq_client.load_table_from_json(data, table, job_config=job_config, project="project_B")

would give the error 400 "Value project_B in content does not agree with value project_A. This can happen when a value set through a parameter is inconsistent with a value set in the request."

It seems the upload URL is always set to the client's project.

upload_url = _MULTIPART_URL_TEMPLATE.format(project=self.project)

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Jan 18, 2021
@plamut plamut added the type: question Request for information or clarification. Not an issue. label Jan 19, 2021
@plamut
Copy link
Contributor

plamut commented Jan 21, 2021

I can confirm the reported behavior. The load_table_from_file() receives the target project name, sets it on the job, but then the _do_multipart_upload() indeed just uses the project configured by the client in the URL. Ditto for resumable uploads.

Thanks for catching and reporting that!

@plamut plamut self-assigned this Jan 21, 2021
@plamut plamut added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed type: question Request for information or clarification. Not an issue. labels Jan 21, 2021
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 API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
2 participants