Airflow: Is there a way to copy variables from one Composer version to another Composer version using Cloud Shell?

huangapple go评论55阅读模式
英文:

Airflow: Is there a way to copy variables from one Composer version to another Composer version using Cloud Shell?

问题

我正在进行迁移任务,涉及在Cloud Shell中从一个Cloud Composer版本复制变量到另一个Cloud Composer版本。

不过,在Cloud Shell中是否有可能完成这样的任务?

我已经阅读了Airflow和Composer文档;但是,似乎找不到可以允许我从一个Composer版本复制变量到另一个版本的工作命令。

英文:

I am working on a migration task, which involves copying variables from one Cloud Composer version to another Cloud Composer version using Cloud Shell.

Though, is it possible to accomplish such a task in Cloud Shell?

I have read the Airflow and Composer documentation; though, I cannot seem to find a working command that will allow me to copy variables from one Composer version to another.

答案1

得分: 0

没有一个单独的Airflow CLI命令可以"移动"变量从一个Airflow环境到另一个;但是,你可以从源环境导出变量到一个文件,然后从同一个文件中导入到目标环境

类似这样:

从源环境导出

gcloud composer environments run SOURCE_ENVIRONMENT_NAME \
    --location SOURCE_LOCATION \
    variables export \
    my_file.json

导入到目标环境

gcloud composer environments run TARGET_ENVIRONMENT_NAME \
    --location TARGET_LOCATION \
    variables import \
    my_file.json
英文:

There isn't a single Airflow CLI command to "move" Variables from one Airflow environment to another; however, you can export Variables from source environment to a file and then import from the same file to the target environment.

Something like this:

Export from source environment

gcloud composer environments run SOURCE_ENVIRONMENT_NAME \
    --location SOURCE_LOCATION \
    variables export \
    my_file.json

Import to target environment

gcloud composer environments run TARGET_ENVIRONMENT_NAME \
    --location TARGET_LOCATION \
    variables import \
    my_file.json

huangapple
  • 本文由 发表于 2023年2月8日 23:53:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75388369.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定