Skip to content

Instantly share code, notes, and snippets.

@kamatama41
Last active November 30, 2016 02:29
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 kamatama41/fecf2aa337c752ec9258563260d2e4a0 to your computer and use it in GitHub Desktop.
Save kamatama41/fecf2aa337c752ec9258563260d2e4a0 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eu
dataset=kamatama_test
table="creation_test"
bq rm -f ${dataset}.${table}
bq mk --schema ts:string,cnt:integer -t ${dataset}.${table}
try_count=0
retry_limit=1200
wait_seconds=1
until [ ${try_count} -eq ${retry_limit} ]; do
json="{\"ts\": \"$(date +"%h:%M:%S")\", \"cnt\": ${try_count}}"
echo "${json}"
echo "${json}" | bq insert ${dataset}.${table}
sleep ${wait_seconds}
try_count=$(expr $try_count \+ 1)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment