-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload_data.sh
executable file
·30 lines (25 loc) · 1021 Bytes
/
load_data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Edit installation path (path where DSBULK files are extracted)
INSTALLATION_PATH=/Users/oktay.tuncay/Desktop/DataStax_Notes/Migration/test_dsbulk
# Define the base path for the command
DSBULK_PATH="$INSTALLATION_PATH/dsbulk-1.11.0/bin/dsbulk"
CONFIG_FILE="$INSTALLATION_PATH/dsbulk.conf"
BASE_URL="$INSTALLATION_PATH/data"
BUNDLE_PATH="$INSTALLATION_PATH/envs/scb-target-db.zip"
USERNAME="cTJwiSHU....."
PASSWORD="ekOtyZ....WsyZMAEwFnEDZrp1HLiekdhlJ-oaAoe1qG6G...ONPoTs9"
TABLE_LIST="$INSTALLATION_PATH/table_list.sql"
# Read each line from the file containing the list of tables
while read line; do
# Extract the keyspace and table name
KEYSPACE=$(echo "$line" | cut -d '.' -f 1)
TABLE=$(echo "$line" | cut -d '.' -f 2)
# Generate the URL for data load
URL="$BASE_URL/$KEYSPACE/$TABLE"
# Execute the dsbulk load command
$DSBULK_PATH load -k $KEYSPACE -t $TABLE -f $CONFIG_FILE \
-url $URL \
-b $BUNDLE_PATH \
-u $USERNAME \
-p $PASSWORD
done < "$TABLE_LIST"