Skip to content

[BigQuery] Provide method to retrieve Table from any project #3073

Closed

Description

@marcin-kolda

We have a use case, when one BigQuery service needs to retrieve tables from multiple project. Right now we need to recreate a new service for every project.

Could you please overload getTable() method in BigQuery.java with additional projectId parameter? Example:
Table getTable(String projectId, String datasetId, String tableId, TableOption... options);

Activity

  1. added
    type: feature request
    api: bigquery
    priority: p2
    on Mar 29, 2018
  2. MMMarcy commented on May 17, 2018

    @MMMarcy

    Marcin, it is now possible by using:

    BigQuery bigQuery = BigQueryOptions.newBuilder()
            .setProjectId("your-project")
            .build().getService();
    
    Table t1 = bigQuery.getTable(TableId.of(
            "another-project",
            "dataset1",
            "table1"));
    // getTable targeting a public dataset/table on another project
    Table t2 = bigQuery.getTable(TableId.of(
            "bigquery-public-data",
            "austin_311",
            "311_service_requests"));

    Also, while investigating this I found that TableId.setProject has an unexpected and undocumented behavior of not updating the project is the projectId is already set to a non-null value.

  3. marcin-kolda commented on May 18, 2018

    @marcin-kolda
    Author

    Thanks @MMMarcy. I guess this issue can be closed now

  4. added
    🚨 critical
    on Sep 18, 2018
  5. removed
    🚨 critical
    priority: p2
    on Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: bigquerytype: feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions