通过Cloud SQL API将CSV上传到Google Cloud Storage时出错 [英] Error Uploading CSV to Google Cloud Storage through Cloud SQL API

查看:75
本文介绍了通过Cloud SQL API将CSV上传到Google Cloud Storage时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google Cloud SQL中有一些数据,我正尝试使用Cloud SQL API(测试版)(导出)功能将其传输到Google Cloud Storage.为此,我在Google计算引擎上安装了jupyter notebook,并在其上运行python代码(以连接到云sql API并将日期导出到csv文件中的云存储中).

I have some data in Google Cloud SQL, which I am trying to transfer to Google Cloud Storage using Cloud SQL API(beta) (export) function. For this, I have installed jupyter notebook on google compute engine and I am running the python code (to connect to cloud sql API and export the date to cloud storage in a csv file) on that.

python代码不会引发任何错误,并且API响应中也没有错误正文.但是,API的响应显示为" u'status':u'PENDING'",并且我看到以下错误(在Cloud SQL仪表板的日志中): 将CSV文件上传到GCS时出错:gs://[BUCKET_NAME]/[FILE_NAME] .csv:帐户[SERVICE_ACCOUNT_NAME] @ speckle-umbrella-11.iam.gserviceaccount.com的访问被拒绝(权限问题?)

The python code does not throw any error and also there is no error body in API response. However, the API's response says "u'status': u'PENDING'" and I see the following error (in logs of Cloud SQL Dashboard) : error uploading CSV file to GCS: gs://[BUCKET_NAME]/[FILE_NAME].csv: Access denied for account [SERVICE_ACCOUNT_NAME]@speckle-umbrella-11.iam.gserviceaccount.com (permission issue?)

如何确保我拥有该帐户的所有相关访问权限( [SERVICE_ACCOUNT_NAME] @ speckle-umbrella-11.iam.gserviceaccount.com )?我无法找到该帐户或无法访问此帐户.

How do I ensure I have all the relevant access for the account ([SERVICE_ACCOUNT_NAME]@speckle-umbrella-11.iam.gserviceaccount.com) ? I am unable to locate this account or give myself access to this .

推荐答案

您需要向Cloud SQL实例服务帐户授予对存储桶的访问权限.访问导出文档,然后单击GCLOUD (2ND GEN)标签,其中将显示您需要使用的命令.

You need to grant the Cloud SQL instance service account access to your bucket. Visit the export documentation and click the GCLOUD (2ND GEN) tab which will show you the commands you need to use.

授予服务帐户对存储桶访问权限的命令是

The command to grant the service account access to the bucket is

gsutil acl ch -u [SERVICE_ACCOUNT_ADDRESS]:W gs://[BUCKET_NAME]

这篇关于通过Cloud SQL API将CSV上传到Google Cloud Storage时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆