Commit c85ee5e7 authored by Eduardo L. Buratti's avatar Eduardo L. Buratti

Merge branch 'charts'

parents 90bec707 9da20bc1
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
#!/bin/bash
# Copyright (C) 2007-2013 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of database
......@@ -18,21 +19,38 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#!/bin/bash
export DB_NAME=$1
DB_LINK_LOCATION=/usr/share/postgresql/8.4/contrib/dblink.sql
# checking parameters
if [[ -z $DB_NAME ]]; then
echo "usage: $0 [database_name]"
exit 1
fi
DUMPDIR='/var/lib/postgresql/database/dump'
LOADDIR='/var/lib/postgresql/database'
DUMPFILE="dump_$(date +%d_%m_%y).sql"
DUMP_PARAM="--format custom --blobs"
# importing db_link functions
psql $DB_NAME -f $DB_LINK_LOCATION
cd $DUMPDIR
# creating database tables and structure
for file in $(ls -B create/); do
psql $DB_NAME -f create/$file
done
pg_dump mec_seed $DUMP_PARAM > "$DUMPFILE"
# importing database functions
for file in $(ls -B load/); do
psql $DB_NAME -f load/$file
done
cp $DUMPFILE dump.sql
date > dumpDate
# restore database data
for file in $(ls -B data/); do
psql $DB_NAME -f data/$file
done
cd $LOADDIR
# importing pre-defined queries
for file in $(ls -B query/); do
psql $DB_NAME -f query/$file
done
psql -d mec_seed -f load.sql
# installing crontab
./cron.sh
/* types */
CREATE TYPE project_enum AS enum (
'proinfo',
'uca_classmate',
'uca_server',
'projector'
);
/* OLTP operational database tables */
CREATE TABLE proinfo_inventory (
contact_date DATE DEFAULT CURRENT_DATE NOT NULL,
project INTEGER DEFAULT 0 NOT NULL,
inep CHARACTER VARYING(18) NOT NULL,
macaddr CHARACTER VARYING(18) NOT NULL,
os_type TEXT,
os_distro TEXT,
os_kernel TEXT,
processor TEXT,
memory INTEGER,
disk1_model TEXT,
disk1_size INTEGER,
disk1_used INTEGER,
disk2_model TEXT,
disk2_size INTEGER,
disk2_used INTEGER,
extra_hds SMALLINT DEFAULT 0 NOT NULL
);
CREATE TABLE proinfo_net_usage (
contact_date DATE DEFAULT CURRENT_DATE NOT NULL,
inep CHARACTER VARYING(18) NOT NULL,
macaddr CHARACTER VARYING(18) NOT NULL,
collect_time TIME WITHOUT TIME ZONE,
down_kbits BIGINT,
down_packages INTEGER,
up_kbits BIGINT,
up_packages INTEGER
);
CREATE TABLE rejected_inventory (
id INTEGER,
sch_id INTEGER,
cit_id INTEGER,
contact_date DATE NOT NULL,
project INTEGER,
inep CHARACTER VARYING(18) NOT NULL,
macaddr TEXT NOT NULL,
os_type TEXT,
os_distro TEXT,
os_kernel TEXT,
processor TEXT,
memory INTEGER,
disk1_model TEXT,
disk1_size INTEGER,
disk1_used INTEGER,
disk2_model TEXT,
disk2_size INTEGER,
disk2_used INTEGER,
extra_hds SMALLINT
);
CREATE TABLE rejected_net_usage (
sch_id INTEGER,
cit_id INTEGER,
contact_date DATE DEFAULT CURRENT_DATE NOT NULL,
inep CHARACTER VARYING(18) NOT NULL,
macaddr CHARACTER VARYING(18) NOT NULL,
collect_time TIME WITHOUT TIME ZONE,
down_kbits BIGINT,
down_packages INTEGER,
up_kbits BIGINT,
up_packages INTEGER
);
-- dimension city
CREATE TABLE dim_city (
id SERIAL PRIMARY KEY,
name CHARACTER VARYING(100) NOT NULL,
state CHARACTER VARYING(2) NOT NULL,
region CHARACTER VARYING(12) NOT NULL,
CHECK (name <> ''),
CHECK (state <> ''),
CHECK (region <> '')
);
-- dimension school
CREATE TABLE dim_school (
id SERIAL PRIMARY KEY,
cit_id INTEGER NOT NULL REFERENCES dim_city,
inep CHARACTER VARYING(12) NOT NULL,
name CHARACTER VARYING(150) NOT NULL,
address CHARACTER VARYING(100),
cep CHARACTER VARYING(10)
CHECK (inep <> ''),
CHECK (name <> '')
);
-- dimension date
CREATE TABLE dim_date (
id DATE PRIMARY KEY,
day SMALLINT NOT NULL,
month SMALLINT NOT NULL,
year SMALLINT NOT NULL,
CHECK (TO_DATE(year || '-' || month || '-' || day, 'YYYY-MM-DD') = id)
);
-- dimension inventory
CREATE TABLE dim_inventory (
id SERIAL PRIMARY KEY,
sch_id INTEGER NOT NULL REFERENCES dim_school,
macaddr MACADDR NOT NULL,
load_date DATE NOT NULL DEFAULT CURRENT_DATE REFERENCES dim_date,
project project_enum DEFAULT 'proinfo' NOT NULL,
-- inventory info
disk1_model TEXT NOT NULL,
disk1_size INTEGER NOT NULL,
disk1_used INTEGER NOT NULL,
disk2_model TEXT,
disk2_size INTEGER,
disk2_used INTEGER,
memory INTEGER NOT NULL,
processor TEXT NOT NULL,
os_type TEXT NOT NULL,
os_distro TEXT NOT NULL,
os_kernel TEXT NOT NULL,
is_first BIT NOT NULL DEFAULT '0',
is_current BIT NOT NULL DEFAULT '1',
CHECK (macaddr <> '00:00:00:00:00:00')
);
-- fact tables
CREATE TABLE fact_contact (
id SERIAL PRIMARY KEY,
sch_id INTEGER NOT NULL REFERENCES dim_school,
cit_id INTEGER NOT NULL REFERENCES dim_city,
dat_id DATE NOT NULL REFERENCES dim_date,
macaddr MACADDR NOT NULL,
project project_enum DEFAULT 'proinfo' NOT NULL,
UNIQUE (sch_id, cit_id, dat_id, macaddr)
);
CREATE TABLE fact_net_usage (
id SERIAL PRIMARY KEY,
sch_id INTEGER NOT NULL REFERENCES dim_school,
cit_id INTEGER NOT NULL REFERENCES dim_city,
dat_id DATE NOT NULL REFERENCES dim_date,
macaddr MACADDR NOT NULL,
collect_time TIME WITHOUT TIME ZONE NOT NULL,
down_kbits BIGINT NOT NULL DEFAULT 0,
down_packages INTEGER NOT NULL DEFAULT 0,
up_kbits BIGINT NOT NULL DEFAULT 0,
up_packages INTEGER NOT NULL DEFAULT 0
);
CREATE TABLE aggr_availability (
sch_id INTEGER NOT NULL REFERENCES dim_school,
cit_id INTEGER NOT NULL REFERENCES dim_city,
dat_id DATE NOT NULL REFERENCES dim_date,
mac_count BIGINT NOT NULL DEFAULT 0,
mac_count_red BIGINT NOT NULL DEFAULT 0,
mac_count_yellow BIGINT NOT NULL DEFAULT 0,
mac_count_green BIGINT NOT NULL DEFAULT 0,
project project_enum DEFAULT 'proinfo' NOT NULL,
UNIQUE (sch_id, cit_id, dat_id, project)
);
-- Control table with the starting and ending times of each load process
CREATE TABLE control (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP NOT NULL,
total INTEGER NOT NULL
);
-- should we create an index on dim_inventory.is_current? Bitmap would be the best type...
CREATE LANGUAGE plpgsql;
/* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of database
*
* database is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
COMMENT ON TABLE mectb00_staging_area IS 'Transition table with temporary
data';
COMMENT ON TABLE mectb01_escola_dim IS 'Table with data from schools.';
COMMENT ON TABLE mectb02_catalogo_dim IS 'Catalog table of hardware
components.';
COMMENT ON TABLE mectb03_data_dim IS 'Table of dates.';
COMMENT ON TABLE mectb04_maquina_dim IS 'Table with data from machines.';
COMMENT ON TABLE mectb05_disponibilidade_fact IS 'Table with history of
machines connections.';
COMMENT ON TABLE mectb06_uso_fact IS 'Table using the network of machines.';
COMMENT ON TABLE mectb07_inventario_fact IS 'Inventory table of the
machines.';
COMMENT ON TABLE mectb08_dm_disp IS 'Classification table of the
availability of machines.';
COMMENT ON TABLE mectb09_dm_disp_ag IS 'Aggregation by city table
mectb08_dm_disp.';
COMMENT ON TABLE mectb10_dm_inventario IS 'Join table of inventory from
machines.';
COMMENT ON TABLE mectb11_dm_auditoria IS 'Table grouping by the School of
machines installed and expected.';
COMMENT ON TABLE mectb12_dm_instaladas_ag IS 'Table grouping by month and
state of the machines installed, provided, by changing the hard disk and
memory.';
COMMENT ON TABLE mectb13_dm_rede IS 'Table that stores per-school network
usage information.';
COMMENT ON TABLE mectb99_control IS 'Control table of consolidated
database.';
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of database
#
# database is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#!/bin/bash
psql -f create_sa.sql
psql -d mec_seed -f create_control.sql
psql -d mec_seed -f create_dm.sql
psql -d mec_seed -f create_dw.sql
psql -d mec_seed -f comment_table.sql
psql -d mec_seed -f create_user.sql
psql -d mec_seed -f grants_user.sql
psql -d mec_seed -f insert_datas_1.sql
psql -d mec_seed -f insert_datas_2.sql
/* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of database
*
* database is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
CREATE TABLE mectb99_control (
ctr_id SERIAL PRIMARY KEY,
ctr_bd VARCHAR(2),
ctr_inicio VARCHAR,
ctr_fim VARCHAR,
ctr_total INTEGER
);
/* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of database
*
* database is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
CREATE TABLE mectb08_dm_disp (
dis_inep VARCHAR(18),
dis_maquina VARCHAR(18),
dis_regiao VARCHAR(12),
dis_estado VARCHAR(100),
dis_cidade VARCHAR(100),
dis_escola VARCHAR(100),
dis_data DATE,
dis_data_ult_contato DATE,
dis_qtd_dias_ult_contato INTEGER,
dis_qtd_contato_mes INTEGER,
dis_classificacao VARCHAR(9),
dis_projeto INTEGER
);
CREATE TABLE mectb09_dm_disp_ag (
dis_data DATE,
dis_ano INTEGER,
dis_mes INTEGER,
dis_mes_nm VARCHAR(9),
dis_dia INTEGER,
dis_verde INTEGER,
dis_amarelo INTEGER,
dis_vermelho INTEGER,
dis_regiao VARCHAR(12),
dis_estado VARCHAR(100),
dis_cidade VARCHAR(100),
dis_projeto INTEGER
);
CREATE TABLE mectb10_dm_inventario (
inv_data DATE,
inv_ano INTEGER,
inv_mes INTEGER,
inv_mes_nm VARCHAR(9),
inv_dia INTEGER,
inv_inep VARCHAR(18),
inv_maquina VARCHAR(18),
inv_regiao VARCHAR(12),
inv_estado VARCHAR(100),
inv_cidade VARCHAR(100),
inv_escola VARCHAR(100),
inv_so VARCHAR,
inv_modelo_proc VARCHAR,
inv_qtde_mem INTEGER,
inv_tam_disco INTEGER,
inv_disco_ocupado INTEGER,
inv_alerta_hd BIT,
inv_alerta_mem BIT,
inv_projeto INTEGER
);
CREATE TABLE mectb11_dm_auditoria (
aud_data DATE,
aud_ano INTEGER,
aud_mes INTEGER,
aud_mes_nm VARCHAR(9),
aud_dia INTEGER,
aud_inep VARCHAR(18),
aud_regiao VARCHAR(12),
aud_estado VARCHAR(100),
aud_cidade VARCHAR(100),
aud_escola VARCHAR(100),
aud_instaladas INTEGER,
aud_previstas INTEGER,
aud_projeto INTEGER
);
CREATE TABLE mectb12_dm_instaladas_ag (
inst_data DATE,
inst_ano INTEGER,
inst_mes INTEGER,
inst_mes_nm VARCHAR(9),
inst_regiao VARCHAR(12),
inst_estado VARCHAR(100),
inst_instaladas INTEGER,
inst_previstas INTEGER,
inst_hd_modificado INTEGER,
inst_mem_modificada INTEGER,
inst_projeto INTEGER
);
CREATE TABLE mectb13_dm_rede (
rede_inep VARCHAR(18),
rede_regiao VARCHAR(12),
rede_estado VARCHAR(100),
rede_cidade VARCHAR(100),
rede_escola VARCHAR(100),
rede_data DATE,
rede_time TIMESTAMP WITHOUT TIME ZONE,
rede_pacotes_in INTEGER,
rede_bytes_in REAL,
rede_pacotes_out INTEGER,
rede_bytes_out REAL
);
/* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of database
*
* database is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
CREATE TABLE mectb01_escola_dim (
esc_id SERIAL PRIMARY KEY,
esc_inep VARCHAR(12) UNIQUE,
esc_regiao VARCHAR(12),
esc_uf VARCHAR(2),
esc_municipio VARCHAR(100),
esc_nome VARCHAR(150),
esc_endereco VARCHAR(100),
esc_cep VARCHAR(10),
esc_maq_prev INTEGER
);
CREATE TABLE mectb02_catalogo_dim (
cat_id serial PRIMARY KEY,
cat_componente VARCHAR(20),
cat_modelo VARCHAR(50),
cat_descricao VARCHAR,
cat_descricao2 VARCHAR UNIQUE
);
CREATE TABLE mectb03_data_dim (
dat_id serial PRIMARY KEY,
dat_data DATE,
dat_ano INTEGER,
dat_mes INTEGER,
dat_dia INTEGER
);
CREATE TABLE mectb04_maquina_dim (
maq_id serial primary key,
maq_identificador VARCHAR UNIQUE,
maq_dat_id INTEGER references mectb03_data_dim,
maq_esc_id INTEGER references mectb01_escola_dim,
maq_mac VARCHAR(18),
maq_inventario VARCHAR,
maq_data_remocao DATE,
maq_origem BIT,
maq_conexao BIT,
maq_projeto INTEGER
);
CREATE TABLE mectb05_disponibilidade_fact (
dis_dat_id INTEGER references mectb03_data_dim,
dis_maq_id INTEGER references mectb04_maquina_dim
);
CREATE TABLE mectb06_uso_fact (
uso_dat_id INTEGER references mectb03_data_dim,
uso_maq_id INTEGER references mectb04_maquina_dim,
uso_carga_rede INTEGER
);
CREATE TABLE mectb07_inventario_fact (
inv_dat_id INTEGER references mectb03_data_dim,
inv_maq_id INTEGER references mectb04_maquina_dim,
inv_cat_id INTEGER references mectb02_catalogo_dim,
inv_id_status CHAR,
inv_alarme BIT,
inv_disco_usado INTEGER
);
/* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of database
*
* database is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
DROP DATABASE mec_seed;
CREATE DATABASE mec_seed;
\c mec_seed;
CREATE TABLE mectb00_staging_area (
sa_inep VARCHAR(18),
sa_mac VARCHAR(18),
sa_disco1_modelo TEXT,
sa_disco1_capacidade INTEGER,
sa_disco1_usado INTEGER,
sa_disco2_modelo TEXT,
sa_disco2_capacidade INTEGER,
sa_disco2_usado INTEGER,
sa_discos_ad INTEGER,
sa_memoria INTEGER,
sa_processador TEXT,
sa_so_nome TEXT,
sa_so_distribuicao TEXT,
sa_so_kernel TEXT,
sa_uso_up INTEGER,
sa_uso_down INTEGER,
sa_data TIMESTAMP,
sa_conexao BIT,
sa_projeto INTEGER
);
/* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of database
*
* database is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
CREATE USER my_user;
ALTER USER my_user PASSWORD 'password';
/* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of database
*
* database is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
GRANT INSERT ON mectb00_staging_area TO my_user;
GRANT SELECT ON mectb01_escola_dim TO my_user;
GRANT SELECT ON mectb02_catalogo_dim TO my_user;
GRANT SELECT ON mectb03_data_dim TO my_user;
GRANT SELECT ON mectb04_maquina_dim TO my_user;
GRANT SELECT ON mectb05_disponibilidade_fact TO my_user;
GRANT SELECT ON mectb06_uso_fact TO my_user;
GRANT SELECT ON mectb07_inventario_fact TO my_user;
GRANT SELECT ON mectb08_dm_disp TO my_user;
GRANT SELECT ON mectb09_dm_disp_ag TO my_user;
GRANT SELECT ON mectb10_dm_inventario TO my_user;
GRANT SELECT ON mectb11_dm_auditoria TO my_user;
GRANT SELECT ON mectb12_dm_instaladas_ag TO my_user;
GRANT SELECT ON mectb13_dm_rede TO my_user;
This diff is collapsed.
This diff is collapsed.
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Copyright (C) 2007-2013 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of database
......@@ -19,7 +19,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
LOADFILE='/var/lib/postgresql/database/load/load.sh'
LOGFILE="/var/lib/postgresql/database/log/$(date +%d_%m_%y).log"
COMMAND="psql -d $DB_NAME -c 'SELECT load_dw();'"
echo "59 23 * * * $LOADFILE > $LOGFILE" | crontab -
echo "59 23 * * * $COMMAND" | crontab -
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
-- Function that creates staging area temporary tables
-- This function should NOT be called directly. See load_dw().
CREATE OR REPLACE FUNCTION sa_create() returns void as $$
BEGIN
PERFORM sa_inventory_create();
PERFORM sa_net_usage_create();