-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_db
executable file
·27 lines (23 loc) · 1.09 KB
/
install_db
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
#!/bin/bash
#Install DBT-1 database
#create database
createdb dbt1
DATAGEN_FOLDER=$HOME/git/dbt1/datagen
PORT=5432
DBT1=dbt1
#launch DDL
echo "Launching dbt-1 DDL"
psql -p $PORT -f datagen/create_tables.sql $DBT1
psql -p $PORT -f datagen/create_sequence.sql $DBT1
sleep 1
#install data
echo "filling in dbt1 tables with data"
psql -p $PORT -c "copy address from '$DATAGEN_FOLDER/address.data' delimiter '>'" $DBT1
psql -p $PORT -c "copy author from '$DATAGEN_FOLDER/author.data' delimiter '>'" $DBT1
psql -p $PORT -c "copy cc_xacts from '$DATAGEN_FOLDER/cc_xacts.data' delimiter '>'" $DBT1
psql -p $PORT -c "copy country from '$DATAGEN_FOLDER/country.data' delimiter '>'" $DBT1
psql -p $PORT -c "copy customer from '$DATAGEN_FOLDER/customer.data' delimiter '>'" $DBT1
psql -p $PORT -c "copy item from '$DATAGEN_FOLDER/item.data' delimiter '>'" $DBT1
psql -p $PORT -c "copy order_line from '$DATAGEN_FOLDER/order_line.data' delimiter '>'" $DBT1
psql -p $PORT -c "copy orders from '$DATAGEN_FOLDER/orders.data' delimiter '>'" $DBT1
psql -p $PORT -c "copy stock from '$DATAGEN_FOLDER/stock.data' delimiter '>'" $DBT1