Skip to content

DB data management commands explanation and usage

andrea rota edited this page Jul 21, 2021 · 3 revisions

You need to have the API running, and a full DB setup (if you don't have a full DB, run the below commands and grab a cup of tea, the normal process should take between 30 and 45 min to fulfill):

make start-api
make seed-geodb-data # this will first seed api with test data

These commands will generate a full dump of your DBs in data/data/processed/db_dumps/

make dump-geodb-data && make dump-api-data

You need to have the dumps ready in data/data/processed/db_dumps/, have the az cli tool available in your local environment, and to be logged in to Azure with suitable permissions for the storage accounts and buckets to be used.

make upload-dump-data

In order to restore the DB you can do:

make restore-dumps

And now that we have a full DB fresh and restored you can if you want, extract and generate new testing data:
Requirements: make notebooks and a geometry defined in api/test/fixtures/test-geometry.json.

This will generate data in data/data/processed and it will then parse it into SQL insert commands and will finally move files to api/test/fixtures.

make generate-geo-test-data

or if you want to populate db with testing data just do:

make seed-dbs