aboutsummaryrefslogtreecommitdiff
path: root/sources/db
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2010-11-13 21:31:39 +0100
committerJochen Topf <jochen@topf.org>2010-11-13 21:31:39 +0100
commit9db63dc2526bf0b2a94e7a6f37a0f7dabdb8f12d (patch)
tree0d2ae6de413c39c21d30aaf296a98ee37977ab45 /sources/db
parentc82bbe69572398d44187ca7b57b1ce572f435d65 (diff)
downloadtaginfo-9db63dc2526bf0b2a94e7a6f37a0f7dabdb8f12d.tar
taginfo-9db63dc2526bf0b2a94e7a6f37a0f7dabdb8f12d.tar.gz
Multiple changes
* Improved and cleaned up source import scripts * Improved some reports and report overview * New osmium version that uses a better hash function * Some experimental magic to include Javascipt in an easier way (tested in keys.erb)
Diffstat (limited to 'sources/db')
-rwxr-xr-xsources/db/osmium_tagstatsbin135169 -> 128430 bytes
-rw-r--r--sources/db/post.sql2
-rw-r--r--sources/db/pre.sql19
-rwxr-xr-xsources/db/update.sh17
4 files changed, 13 insertions, 25 deletions
diff --git a/sources/db/osmium_tagstats b/sources/db/osmium_tagstats
index 618ee6d..ab5e21e 100755
--- a/sources/db/osmium_tagstats
+++ b/sources/db/osmium_tagstats
Binary files differ
diff --git a/sources/db/post.sql b/sources/db/post.sql
index e182a28..e824c48 100644
--- a/sources/db/post.sql
+++ b/sources/db/post.sql
@@ -61,5 +61,5 @@ UPDATE keys SET prevalent_values=(
ANALYZE;
-UPDATE meta SET update_end=datetime('now');
+UPDATE source SET update_end=datetime('now');
diff --git a/sources/db/pre.sql b/sources/db/pre.sql
index 998b20e..38ec051 100644
--- a/sources/db/pre.sql
+++ b/sources/db/pre.sql
@@ -6,24 +6,7 @@
.bail ON
-DROP TABLE IF EXISTS meta;
-
-CREATE TABLE meta (
- source_id TEXT,
- source_name TEXT,
- update_start TEXT,
- update_end TEXT,
- data_until TEXT
-);
-
-INSERT INTO meta (source_id, source_name, update_start) SELECT 'db', 'Database', datetime('now');
-
-DROP TABLE IF EXISTS stats;
-
-CREATE TABLE stats (
- key TEXT,
- value INT64
-);
+INSERT INTO source (id, name, update_start) SELECT 'db', 'Database', datetime('now');
DROP TABLE IF EXISTS keys;
diff --git a/sources/db/update.sh b/sources/db/update.sh
index 4ab2856..56a7652 100755
--- a/sources/db/update.sh
+++ b/sources/db/update.sh
@@ -9,32 +9,37 @@ set -e
DIR=$1
+DATECMD='date +%Y-%m-%dT%H:%M:%S'
+
if [ "x" = "x$DIR" ]; then
echo "Usage: update.sh DIR"
exit 1
fi
-echo -n "Start db: "; date
+echo "`$DATECMD` Start db..."
DATABASE=$DIR/taginfo-db.db
rm -f $DATABASE
rm -f $DIR/count.db
-echo "Running pre.sql..."
+echo "`$DATECMD` Running init.sql..."
+sqlite3 $DATABASE <../init.sql
+
+echo "`$DATECMD` Running pre.sql..."
sqlite3 $DATABASE <pre.sql
-echo -n "Running count... "; date
+echo "`$DATECMD` Running count... "
HERE=`pwd`
cd $DIR
bzcat $DIR/planet.osm.bz2 | $HERE/osmium_tagstats -
cd $HERE
-echo -n "Running update_characters... "; date
+echo "`$DATECMD` Running update_characters... "
./update_characters.pl $DIR
-echo -n "Running post.sql... "; date
+echo "`$DATECMD` Running post.sql... "
perl -pe "s|__DIR__|$DIR|" post.sql | sqlite3 $DATABASE
-echo -n "Done db: "; date
+echo "`$DATECMD` Done db."