Skip to content

Instantly share code, notes, and snippets.

@evanfrisch
Created October 31, 2017 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanfrisch/2a5a7bafb46f811c6305ae0343f0b8b3 to your computer and use it in GitHub Desktop.
Save evanfrisch/2a5a7bafb46f811c6305ae0343f0b8b3 to your computer and use it in GitHub Desktop.
#!/bin/bash
OUTPUTFILE=$1
SQLFILE=$2
STARTDATE=$3
ENDDATE=$4
bq query -q --headless --format=csv --use_legacy_sql=false --max_rows=10000000 --parameter start_date:TIMESTAMP:$STARTDATE --parameter end_date:TIMESTAMP:$ENDDATE > ~/$OUTPUTFILE "$(< ${SQLFILE})"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment