#!/bin/bash
PROJECT_ID=任意のもの
DATASET_ID=任意のもの
NEW_EXPIRATION="none"
TABLES=$(bq ls --project_id=$PROJECT_ID --dataset_id=$DATASET_ID --format=json | jq -r '.[] | .tableReference.tableId')
for TABLE in $TABLES; do
bq show --format=prettyjson $PROJECT_ID:$DATASET_ID.$TABLE > schema.json
jq '.expirationTime = "'$NEW_EXPIRATION'"' schema.json > temp.json
bq update --source=temp.json $PROJECT_ID:$DATASET_ID.$TABLE
rm schema.json temp.json
done
指定したdataset配下のTBの有効期限を一括で"none"にするシェル
Last updated at Posted at 2024-06-12
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme