googleapis / googleapis/google-cloud-node

@google-cloud/bigquery projectId is always inferred from dataset

Open
#8,268 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

### Library Name

@google-cloud/bigquery

### A screenshot that you have tested with "Try this API".

Hello there,

Currently, There's no way to set projectId for load job creation.

When using `Table#load` or `Table#createWriteStream` operation, Job creation always happens on dataset project regardless what is already set on BigQuery client.
https://github.com/googleapis/google-cloud-node/blob/main/handwritten/bigquery/src/table.ts#L1571

If the project where the job is created and the dataset accessed by the job are the same, there is no issue; however, if they need to be distinguished, the current design cannot accommodate this.

For example, suppose a client’s authentication allows access to datasets under three projects—acme-a, acme-b, and acme-c—but job submissions are permitted only for the acme-b project. In this scenario, if data is loaded into a dataset under the acme-a (or acme-c) project, the job will be submitted to acme-a, resulting in a permission issue.

Although the `projectId` can be specified as a parameter in the `createWriteStream` method, it does not appear to be utilized properly.

### What would you like to see in the library?

_No response_

### Describe alternatives you've considered

_No response_

### Additional context/notes

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.