Skip to content

Commit 06f2b3b

Browse files
committed
drop all tables on the derived schema first
1 parent 4a2643b commit 06f2b3b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mimic-iv/concepts/make_concepts.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ export TARGET_DATASET=mimiciv_derived
66
# note: max_rows=1 *displays* only one row, but all rows are inserted into the destination table
77
BQ_OPTIONS='--quiet --headless --max_rows=0 --use_legacy_sql=False --replace'
88

9+
# drop the existing tables in the target dataset
10+
for TABLE in `bq ls physionet-data:${TARGET_DATASET} | cut -d' ' -f3`;
11+
do
12+
# skip the first line of dashes
13+
if [[ "${TABLE:0:2}" == '--' ]]; then
14+
continue
15+
fi
16+
echo "Dropping table ${TARGET_DATASET}.${TABLE}"
17+
bq rm -f -q ${TARGET_DATASET}.${TABLE}
18+
done
19+
920
# generate a few tables first as the desired order isn't alphabetical
1021
for table_path in demographics/icustay_times;
1122
do

0 commit comments

Comments
 (0)