有一个预定的笔记本,它使用BigQuery客户端和具有所有者权限的服务帐户。当我手动运行单元格时,它会更新BQ表。有一个项目,既烧烤和顶点AI。
我也发现了一个类似的问题,但是在桶文件夹中没有输出:谷歌云顶点AI预定运行不运行代码?
在“计划”部分,此记事本停留在初始化:

这是笔记本电脑:


更新:我尝试一个一个地安排单元格,而所有被卡住的尝试都无法通过BigQuery:
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)发布于 2022-04-21 12:14:22
这种授权方式奏效了!
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')解决了这条线中的问题跟踪器。
https://stackoverflow.com/questions/71952492
复制相似问题