Revision 9924
Added by Aaron Marcuse-Kubitza over 11 years ago
make_analytical_db | ||
---|---|---|
15 | 15 |
sleep 5 # wait for tnrs.make to acquire the lock if being run right after import |
16 | 16 |
"$selfDir/waitself" "$selfDir/../inputs/.TNRS/tnrs/tnrs.make" |
17 | 17 |
|
18 |
mk_analytical_table ()
|
|
18 |
mk_table()
|
|
19 | 19 |
{ |
20 | 20 |
local table="$1" |
21 |
local public_table="\"$public\".$table" analyt_table="analytical_db.$table"
|
|
21 |
local public_table="\"$public\".$table" |
|
22 | 22 |
cat <<EOF |
23 | 23 |
-- Create $table |
24 | 24 |
TRUNCATE $public_table; |
25 | 25 |
INSERT INTO $public_table SELECT * FROM ${public_table}_view; |
26 | 26 |
ANALYZE $public_table; |
27 |
EOF |
|
28 |
} |
|
27 | 29 |
|
30 |
mk_analytical_table() |
|
31 |
{ |
|
32 |
local table="$1" |
|
33 |
local public_table="\"$public\".$table" analyt_table="analytical_db.$table" |
|
34 |
cat <<EOF |
|
35 |
$(mk_table "$@") |
|
36 |
|
|
28 | 37 |
-- Create $analyt_table view pointing to table in $public |
29 | 38 |
DROP VIEW IF EXISTS $analyt_table; |
30 | 39 |
CREATE VIEW $analyt_table AS |
Also available in: Unified diff
bin/make_analytical_db: added mk_table() and use it in mk_analytical_table()