Any feature in BigQuery that can migrate a whole dataset in another project w/o executing copy data?

前端 未结 4 1242
刺人心
刺人心 2021-02-08 16:08

While our project grows, at some point we realized that we need to create new projects and reorganize our dataset. One case is that we need to isolate one dataset from others in

4条回答
  •  死守一世寂寞
    2021-02-08 16:11

    A short shell script which copies all tables from a dataset to another dataset:

    export SOURCE_DATASET=$1  # project1:dataset
    export DEST_PREFIX=$2  # project2:dataset2.any_prefix_
    for f in `bq ls $SOURCE_DATASET |grep TABLE | awk '{print $1}'`
    do
      export CP_COMMAND="bq cp $SOURCE_DATASET.$f $DEST_PREFIX$f"
      echo $CP_COMMAND
      echo `$CP_COMMAND`
    done
    

提交回复
热议问题