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

Types for getDatasets methods missing projectId parameter #1130

Closed
MasterOdin opened this issue Jun 16, 2022 · 3 comments
Closed

Types for getDatasets methods missing projectId parameter #1130

MasterOdin opened this issue Jun 16, 2022 · 3 comments
Labels
api: bigquery Issues related to the googleapis/nodejs-bigquery API. priority: p3 Desirable enhancement or 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

@MasterOdin
Copy link

When using TS and passing in a projectId to the getDatasets or getDatasetsStream functions, I get a type error about projectId not being found in GetDatasetsOptions, however I do get back the datasets for the project I specify. It would be nice for this to be not a TS error. Not sure if there's anything more involved here than adding projectId?: string to bigquery.datasets.IListParams?

Environment details

  • OS: macOS 12.4
  • Node.js version: 16.15.0
  • npm version: 8.5.5
  • @google-cloud/bigquery version: 6.0.0

Steps to reproduce

import { BigQuery } from '@google-cloud/bigquery';
const client = new BigQuery(/* credentials */);
const [datasets] = client.getDatasets({ projectId: 'bigquery-public-data' });
@MasterOdin MasterOdin 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. labels Jun 16, 2022
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/nodejs-bigquery API. label Jun 16, 2022
@steffnay steffnay removed their assignment Jul 8, 2022
@loferris loferris self-assigned this Nov 10, 2022
@loferris loferris added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Nov 10, 2022
@loferris
Copy link
Contributor

Hi @MasterOdin, the BigQuery client passes its projectId with the request object, and calls to the /dataset endpoint are appended. There is not a JSON equivalent to a projectId in the Dataset object; therefore, I would not add projectId? to the GetDatasetOptions type interface. Could you elaborate on why this decoupling doesn't work for your use-case?

@MasterOdin
Copy link
Author

MasterOdin commented Nov 14, 2022

My use case is that I'm fetching schema information across multiple projects concurrently. I'd like to avoid having to pay a penalty of constructing multiple BQ clients that only differ from each other based on projectId. As it turns out, passing projectId to getDatasets function works perfectly for this, just that it's a type error, as well as that we have to pass projectId in subsequent functions as shown in #1133.

@alvarowolfx
Copy link
Contributor

#1230 solves this issue.

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/nodejs-bigquery API. priority: p3 Desirable enhancement or 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
Development

No branches or pull requests

4 participants