BigQuery的get_project函数是什么?

huangapple go评论114阅读模式
英文:

Bigquery get_project function?

问题

在BigQuery中,我正在寻找一个函数,用于判断项目是否存在,类似于以下代码:

from google.cloud import bigquery
client = bigquery.Client()

try:
    client.get_project("my_project")
except NotFound:
    print("`my project` not found.")

对于数据集和表格,可以通过get_datasetget_table来实现这一功能。不幸的是,我没有找到get_project的相关内容。

另外,我找不到列出bigquery.Client方法的文档。具体而言,我只想要列出所有方法的页面,类似于tf.keras.layers这个页面。我搜索了所有有关方法的文档(包括参数和它们的用途),但是无法找到GitHub存储库或官方文档。我找到的最好的资料是这里。我是否遗漏了一些明显的东西?

英文:

In bigquery, I am looking for a function that states if a project exists, a la

from google.cloud import bigquery
client = bigquery.Client()

try:
    client.get_project("my_project")
exept NotFound:
    print("`my project` not found.")

This is accomplished for datasets and tables through get_dataset and get_table respectively. I could not find anything for get_project, unfortunately.

As a complete aside, I cannot find documentation listing methods for bigquery.Client anywhere. Specifically, I just want the page that lists all methods; similar to this page for tf.keras.layers. I looked for anywhere with documentation on the methods (complete with arguments and their respective purpose) but could find neither a github repo or official documentaion. The best I found is here. Am I missing something obvious?

答案1

得分: 1

如果您想知道与客户关联的项目,可以使用以下代码:

from google.cloud import bigquery
client = bigquery.Client()
print(client.project) 

这段代码将打印出与客户关联的项目。

英文:

if you want to know which project is associated with client, this would work.

from google.cloud import bigquery
client = bigquery.Client()
print(client.project) 

huangapple
  • 本文由 发表于 2023年8月9日 01:53:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76862067.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定