Skip to content
Snippets Groups Projects
Commit cda12829 authored by Stefan Braß's avatar Stefan Braß
Browse files

db/load_data now does the tsv->sql conversion

parent 31685075
Branches
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Project: ddbench - Deductive System and Database Benchmarks # Project: ddbench - Deductive System and Database Benchmarks
# Filename: db/conv_sql # Filename: db/conv_sql
# Purpose: AWK Script to Translate .tsv Benchmark Result to SQL # Purpose: AWK Script to Translate .tsv Benchmark Result to SQL
# Last Change: 02.02.2019 # Last Change: 04.10.2019
# Language: Shellscript (bash) # Language: Shellscript (bash)
# Author: Stefan Brass # Author: Stefan Brass
# EMail: brass@informatik.uni-halle.de # EMail: brass@informatik.uni-halle.de
...@@ -70,6 +70,11 @@ FNR == 1 { ...@@ -70,6 +70,11 @@ FNR == 1 {
n = split(FILENAME, path_parts, "/"); n = split(FILENAME, path_parts, "/");
arg = path_parts[n]; arg = path_parts[n];
dir = "";
for(i = 1; i < n; i++)
dir = (dir path_parts[i] "/");
#printf("Dir: '" dir "'\n");
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Remove extension "tsv" (tab-separated-values) from input file: # Remove extension "tsv" (tab-separated-values) from input file:
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -150,7 +155,12 @@ FNR == 1 { ...@@ -150,7 +155,12 @@ FNR == 1 {
# Compute the output file name: # Compute the output file name:
#---------------------------------------------------------------------- #----------------------------------------------------------------------
output = (filename[1] ".sql"); # Old version without directory prefix:
#output = (filename[1] ".sql");
# New version with directory prefix:
output = (dir filename[1] ".sql");
#printf("Output: '" output "'\n");
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Now we still have to check the column names in the first line: # Now we still have to check the column names in the first line:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Project: ddbench - Deductive System and Database Benchmarks # Project: ddbench - Deductive System and Database Benchmarks
# Filename: db/load_data # Filename: db/load_data
# Purpose: Shellscript to create database and load all data # Purpose: Shellscript to create database and load all data
# Last Change: 19.03.2019 # Last Change: 04.10.2019
# Language: Shellscript (bash) # Language: Shellscript (bash)
# Author: Stefan Brass # Author: Stefan Brass
# EMail: brass@informatik.uni-halle.de # EMail: brass@informatik.uni-halle.de
...@@ -19,10 +19,17 @@ ...@@ -19,10 +19,17 @@
# Note that the tables and views of the database are dropped first # Note that the tables and views of the database are dropped first
# to start from a clean state. # to start from a clean state.
# It is normal that this generates errors on the first execution. echo "Dropping old versions of database tables and views."
echo "It is normal that there are error messages about missing objects"
echo "when the database is created for the first time."
echo
psql -f drop_db.sql psql -f drop_db.sql
# Create Database Tables (Database Schema): # Create Database Tables (Database Schema):
echo
echo "Creating tables and views of the database."
echo "It is normal that there are notices about implicitly created indexes."
echo
psql -f create_db.sql | grep -v "INSERT 0 1" psql -f create_db.sql | grep -v "INSERT 0 1"
# Create Views: # Create Views:
...@@ -50,6 +57,9 @@ psql -f v_doc.sql # Print Table Data in Markdown Format (->Documentation) ...@@ -50,6 +57,9 @@ psql -f v_doc.sql # Print Table Data in Markdown Format (->Documentation)
psql -f v_scripts.sql # Support for Benchmark Execution Scripts psql -f v_scripts.sql # Support for Benchmark Execution Scripts
# Basic Data: # Basic Data:
echo
echo "Loading basic data about machines, benchmarks, systems, and input files."
echo
psql -f machines.sql | grep -v "INSERT 0 1" psql -f machines.sql | grep -v "INSERT 0 1"
psql -f input_types.sql | grep -v "INSERT 0 1" psql -f input_types.sql | grep -v "INSERT 0 1"
psql -f benchmarks.sql | grep -v "INSERT 0 1" psql -f benchmarks.sql | grep -v "INSERT 0 1"
...@@ -85,8 +95,23 @@ psql -f graph_types.sql | grep -v "INSERT 0 1" ...@@ -85,8 +95,23 @@ psql -f graph_types.sql | grep -v "INSERT 0 1"
psql -f input_graphs.sql | grep -v "INSERT 0 1" psql -f input_graphs.sql | grep -v "INSERT 0 1"
psql -f input_join1.sql | grep -v "INSERT 0 1" psql -f input_join1.sql | grep -v "INSERT 0 1"
# Convert tsv-files with benchmark results to SQL:
# (might be unnecessary, if the SQL files already exist, but is safer,
# because SQL files might be missing or outdated)
echo
echo "Converting tsv-files with benchmark results to SQL INSERT statements."
echo
for FILE in results/*.tsv
do
./conv_sql $FILE
done
# Load SQL files with benchmark results:
echo
echo "Loading benchmark result data. This may take a while ..."
for FILE in results/*.sql for FILE in results/*.sql
do do
psql -f $FILE | grep -v "INSERT 0 1" psql -f $FILE | grep -v "INSERT 0 1"
done done
echo "Done."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment