python - 使用 Airflow 将文件从本地系统上传到 Google Bucket - Python

标签 python google-cloud-platform google-cloud-datastore google-cloud-storage airflow

所以我在 Airflow 上运行这个运算符

from airflow.contrib.operators.file_to_gcs import FileToGoogleCloudStorageOperator

gcp_operator = \
    FileToGoogleCloudStorageOperator(
        task_id='gcp_task',
        src='/Users/john/Documents/tmp',
        dst='gs://constantine-bucket',
        bucket='constantine-bucket',
        google_cloud_storage_conn_id='DataScience',
        mime_type='Folder',
        dag=dag
    )

当我运行这个时,我收到一个错误

"error": "invalid_scope",
"error_description": "\u0026quot;https://www.googleapis.com/auth/devstorage.read_write\u0026quot; is not a valid audience string

有人知道如何在 Airflow 上运行这个运算符吗?

最佳答案

听起来像是缺少依赖项。您应该能够使用以下命令安装 GCP Hook 和运算符:

pip install apache-airflow[gcp_api]

有关更多信息,请参阅此页面:https://airflow.apache.org/installation.html

关于python - 使用 Airflow 将文件从本地系统上传到 Google Bucket - Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52225407/

相关文章:

python - 为自动更正程序快速保存和检索 python 数据结构?

google-app-engine - mvn 应用程序引擎 :deploy system property for configuration

python - Firebase 函数 gen2 python init 不起作用

java - Google App Engine - 检索实体 - 503 服务不可用(上传有效)

python - File To Google Cloud Storage Operator 的替代方案

google-app-engine - 向 Objectify 查询添加排序会导致空结果

python - 评估数组中的 k 个相邻(正或负)元素

python - 使用 Django 支持的站点和 SQLite 随着时间的推移以特定速率递增整数的最佳方法是什么?

python - `For x in locals():` -- 运行时错误 : Why does locals() change size?

google-cloud-platform - 如何获取 GKE 集群哈希值以更新 GCP 防火墙规则