英文:
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_dataset
和get_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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论