Last active
December 22, 2015 21:38
-
-
Save wutali/6534208 to your computer and use it in GitHub Desktop.
Rename dataset on BigQuery.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BQ_CMD='bq' | |
$BQ_CMD show $1 | |
if [ $? -ne 0 ]; then | |
echo "ERROR: $1 dataset not found." | |
exit 1 | |
fi | |
$BQ_CMD show $2 | |
if [ $? -ne 0 ]; then | |
$BQ_CMD mk $2 | |
fi | |
for table in `$BQ_CMD ls -n 1000 $1|sed '1,2d'`; do | |
$BQ_CMD cp $1.$table $2.$table | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment