Skip to content

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

@mooyoul

Description

@mooyoul

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions