summaryrefslogtreecommitdiff
path: root/import
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2015-03-04 16:38:34 +0100
committeremkael <emkael@tlen.pl>2015-03-04 16:38:34 +0100
commitb27f8ef1387509c4b9d778505d185f8e0a541729 (patch)
treeda5fff8fba015fd835abb07ca4540a9110eb9bff /import
parentffd9d4fb6706e609a16b3a5a2fffe0959fd845d3 (diff)
* README files
Diffstat (limited to 'import')
-rw-r--r--import/README.md44
1 files changed, 44 insertions, 0 deletions
diff --git a/import/README.md b/import/README.md
new file mode 100644
index 0000000..7e7b2ab
--- /dev/null
+++ b/import/README.md
@@ -0,0 +1,44 @@
+Overview
+========
+
+import provides wrapper scripts to import the [Ergast](http://ergast.com/mrd/db) database dump to local database, and apply technical and factual fixes.
+
+import is part of [ergast-goodies](README.md) toolset.
+
+Requirements
+============
+
+* pushd/pop for sane working directory management (the script works in its own directory)
+* mysql command-line client
+* [fetcher](fetcher/README.md) (optional)
+
+Usage
+=====
+
+ ./00_base_import.sh [MYSQL PARAMETERS]
+
+ ./01_integrity_import.sh [MYSQL PARAMETERS]
+
+ mysql [MYSQL PARAMETERS] < ./10_fixes.sql
+
+
+Under the hood
+==============
+
+**No database credentials or connection parameters are being stored or processed by the utility.** These are just wrappers, proxying all the parameters to `mysql` client invokation.
+
+Running `00_base_import.sh` imports just the basic, raw Ergast dump. If you already have the database copied locally, you may as well skip it.
+
+The script looks for f1db.sql dump in [fetcher](fetcher/README.md)'s directory and feeds the `mysql` command with its content, relaying all command line parameters to `mysql`.
+
+If the DB dump is not present, the script attempts to fetch it via [fetcher](fetcher/README.md).
+
+The `01_integrity_import.sh` script does the heavy lifting of improving the database under the hood, so it could be used with modern RDBMS techniques. Its main purpose is to create indexes and proper foreign keys constraints in the database.
+
+All the script does is running all the 01?_*.sql scripts against selected database, in alphabetical order (relying on bash wildcard expansion, [which is supposed to guarantee alphabetical order](http://serverfault.com/questions/122737/in-bash-are-wildcard-expansions-guaranteed-to-be-in-order). The SQL scripts are:
+
+* `01a_integrity_fixes.sql` - fixing some of the values which would otherwise conflict with creating foreign key constraints (usually temporarily, since these issues are reported to the upstream Ergast maintainers)
+* `01b_indexes.sql` - creating indexes on some of the columns (chosen arbirtarily, but hopefully using common sense)
+* `01c_constraints.sql` - creating foreign key constraints on all foreign keys in the database
+
+Provided, there's also the `10_fixes.sql` SQL script. It contains fixes for factual errors in the database which have been [reported upstream](http://ergast.com/mrd/bugs), but are yet to have fixes available in the dump.