Commit f706dd31 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Now generates odservatoire.sqlite for superset

parent deecb000
......@@ -77,10 +77,27 @@ generate_legacy_data_from_dbs() {
mkdir -p $GEOJSON_DIR
$PYTHON $LIB_DIR/legacy/generate_geo_jsons.py $SQLITE_DB $GEOJSON_DIR || exit 1
# Copy sqlite_db for superset
# Prepare sqlite_db for superset
# Dump CSV of wanted tables from working db
DB_TEMP_DIR=$CACHE_DIR/db_dumps
mkdir -p $DB_TEMP_DIR
$SQLITE3 -header -csv $SQLITE_DB 'SELECT * FROM data_gouv_datasets' > $DB_TEMP_DIR/data_gouv_datasets.csv
$SQLITE3 -header -csv $SQLITE_DB 'SELECT * FROM data_gouv_organizations' > $DB_TEMP_DIR/data_gouv_organizations.csv
$SQLITE3 -header -csv $SQLITE_DB 'SELECT * FROM data_orga' > $DB_TEMP_DIR/data_orga.csv
$SQLITE3 -header -csv $SQLITE_DB 'SELECT * FROM ods_catalog' > $DB_TEMP_DIR/ods_catalog.csv
# Creates a new base with only needed tables
DB_DIR=$BUILD_DIR/db
mkdir -p $DB_DIR
cp $SQLITE_DB $BUILD_DIR/odservatoire.sqlite
TARGET_DB=$DB_DIR/odservatoire.sqlite
if [ -e $TARGET_DB ]; then
rm -f $TARGET_DB
fi
$PYTHON $LIB_DIR/db/csv_sqlite_import.py $DB_TEMP_DIR/data_gouv_datasets.csv $TARGET_DB
$PYTHON $LIB_DIR/db/csv_sqlite_import.py $DB_TEMP_DIR/data_gouv_organizations.csv $TARGET_DB
$PYTHON $LIB_DIR/db/csv_sqlite_import.py $DB_TEMP_DIR/data_orga.csv $TARGET_DB
$PYTHON $LIB_DIR/db/csv_sqlite_import.py $DB_TEMP_DIR/ods_catalog.csv $TARGET_DB
}
OBS_BUILD_DIR=$BUILD_DIR/observatoire
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment