This should more properly be titled "Setting up a copy of the database on a local machine".
- Extract the schemas from the production server
- Create a new database on the local machine
- Create the production schemas
- Import the quest data into _quest_raw. This implies that you have access to the data, of course. Isaac has a script in the database, ps_load_data(), that loads the data extracts from a hard-coded location. Byron still finds it easier to use his own scala-based script. A few transformations need to be made first:
- #!/bin/bash
source $(dirname $0)/source
for source in $basedir/data/quest/PS_*.txt; do
table_name=$(basename $source .txt)
target=/var/lib/postgresql/incoming/odyssey/_quest_raw/${table_name,,}
echo $source $target
tail -n +2 $source >$target
done
- Use psql to execute "select _quest_raw.ps_correction()" to apply a limited set of corrections to the raw data.
- Use psql to execute "select _quest_view.update_tables()" to load the data from _quest_raw into _quest.
- Use psql to run create_oat.sql to create the oat schema.
- Use psql to run init_schema.sql to initialize the schema with table definitions, etc.
- Use psql to run init_data.sql to load a beginning set of data.
The scripts for steps 1-3 and 7-9 are at
https://github.com/bwbecker/oat_testdb.git
. Steps 1-3 are in teh script duplicate_odyssey.sh.
--
ByronWeberBecker - 2013-06-08