首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >顶点AI计划的笔记本电脑不工作,虽然手动工作

顶点AI计划的笔记本电脑不工作,虽然手动工作
EN

Stack Overflow用户
提问于 2022-04-21 09:57:14
回答 1查看 307关注 0票数 3

有一个预定的笔记本,它使用BigQuery客户端和具有所有者权限的服务帐户。当我手动运行单元格时,它会更新BQ表。有一个项目,既烧烤和顶点AI。

我也发现了一个类似的问题,但是在桶文件夹中没有输出:谷歌云顶点AI预定运行不运行代码?

在“计划”部分,此记事本停留在初始化:

这是笔记本电脑:

更新:我尝试一个一个地安排单元格,而所有被卡住的尝试都无法通过BigQuery:

代码语言:javascript
复制
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'dialogflow-293713-f89fd8f4ed2d.json'

bigquery_client = bigquery.Client()

QUERY = f"""
INSERT `dialogflow-293713.chats.Ежедневная сводка маркетплейса` (date, effectiveness, operatorWorkload)
VALUES({period}, {effectiveness}, {redirectedToSales}, {operatorWorkload})
"""

Query_Results = bigquery_client.query(QUERY)
EN

回答 1

Stack Overflow用户

发布于 2022-04-21 12:14:22

这种授权方式奏效了!

代码语言:javascript
复制
from google.cloud import bigquery
from google.oauth2 import service_account
import json


raw_credential = { "dictionary. copy the dict elements of your credential.json file" }

service_account_info = json.loads(json.dumps(raw_credential))
credentials = service_account.Credentials.from_service_account_info(service_account_info)

client = bigquery.Client(credentials=credentials)
query = """ Your Query """
df = client.query(query).to_dataframe()
#see some results. remove if its not needed.
print(df.head())

# OPTIONAL: If you want to move data to a google cloud storage bucket
from google.cloud import storage

client = storage.Client()
bucket_name = 'my-bucket-id'
bucket = client.get_bucket(bucket_name)
# if folder `output` does not exist it will be created. You can use the name as you want.
bucket.blob("output/output.csv").upload_from_string(df.to_csv(), 'text/csv')

解决了这条线中的问题跟踪器。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71952492

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档