blob: 09a0fccf11fcd7935e211ec21c0d429e5cf54471 [file] [log] [blame]
Instrumentalbc299c02018-09-25 06:42:31 -05001#!/bin/bash
2#
Instrumental9c749702018-10-08 14:26:20 -05003# Push data from Cassandra ".dat" files into Tables
Instrumentalbc299c02018-09-25 06:42:31 -05004# These are obtained from "gzipped" files, or pre-placed (i.e. initialization)
5# in the "dats" directory
6#
7DIR=/opt/app/aaf/cass_init
8cd $DIR
9if [ ! -e dats ]; then
10 if [ -e dat.gz ]; then
11 tar -xvf dat.gz
12 else
13 echo "No Data to push for Cassandra"
14 exit
15 fi
16fi
17cd dats
18for T in $(ls *.dat); do
19 if [ -s $T ]; then
Instrumentalc8dbe982018-10-08 15:49:00 -050020 cqlsh -e "COPY authz.${T/.dat/} FROM '$T' WITH DELIMITER='|';"
Instrumentalbc299c02018-09-25 06:42:31 -050021 fi
22done
23cd $DIR
24#rm -Rf dats
Instrumentalc8dbe982018-10-08 15:49:00 -050025