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
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