Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
Instrumental | 9c74970 | 2018-10-08 14:26:20 -0500 | [diff] [blame] | 3 | # Push data from Cassandra ".dat" files into Tables |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 4 | # These are obtained from "gzipped" files, or pre-placed (i.e. initialization) |
| 5 | # in the "dats" directory |
| 6 | # |
| 7 | DIR=/opt/app/aaf/cass_init |
| 8 | cd $DIR |
| 9 | if [ ! -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 |
| 16 | fi |
| 17 | cd dats |
| 18 | for T in $(ls *.dat); do |
| 19 | if [ -s $T ]; then |
Instrumental | c8dbe98 | 2018-10-08 15:49:00 -0500 | [diff] [blame] | 20 | cqlsh -e "COPY authz.${T/.dat/} FROM '$T' WITH DELIMITER='|';" |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 21 | fi |
| 22 | done |
| 23 | cd $DIR |
| 24 | #rm -Rf dats |
Instrumental | c8dbe98 | 2018-10-08 15:49:00 -0500 | [diff] [blame] | 25 | |