Skip to content

Instantly share code, notes, and snippets.

@polleyg
Created March 20, 2019 05:39
Show Gist options
  • Save polleyg/ef1e0f2fe0471de935518f1a34792a2a to your computer and use it in GitHub Desktop.
Save polleyg/ef1e0f2fe0471de935518f1a34792a2a to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment