[BigQuery][シェルスクリプト]対象viewテーブルをcsvとしてダウンロード

LINEで送る
Pocket

#!/bin/sh
/home/adachin/google-cloud-sdk/bin/bq query --use_legacy_sql=false --format=csv --max_rows=10000000 'SELECT * FROM `pre-adachin.db.test_view`  where login_date BETWEEN "2019-6-01" AND "2019-07-31"' >> /tmp/test.csv

sed -i '/user_id/d' /tmp/test.csv  #user_id 文字列の削除

sed -i '/^$/d' /tmp/test.csv # 改行の削除

Was this helpful?

0 / 0

コメントを残す 0

Your email address will not be published. Required fields are marked *