Created
November 14, 2016 20:33
-
-
Save jjmalina/a57f7fad038c4035da2d30ccae04709f to your computer and use it in GitHub Desktop.
Copy Google Analytics sessions data using BigQuery -> Google Cloud Storage -> Amazon S3
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
# usage | |
# ./copy_ga_sessions.sh <app> <ga_view> <day> <gcsbucket> <s3bucket> | |
app=$1 | |
view=$2 | |
day=$3 | |
gcsbucket=$4 | |
s3bucket=$5 | |
format=NEWLINE_DELIMITED_JSON | |
tablename="$app:$view.ga_sessions_$day" | |
bucketname="$gcsbucket" | |
bq extract --compression=GZIP --destination_format=NEWLINE_DELIMITED_JSON $tablename gs://$bucketname/$view/ga_sessions_$day.gz | |
gsutil cp gs://$bucketname/$view/ga_sessions_$day.gz . | |
aws s3 cp ga_sessions_$day.gz "s3://$s3bucket/ga_sessions/$view/$day.gz" | |
rm ga_sessions_$day.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment