1. Create a PostgreSQL database and enable the PostGIS extension:
SQLALCHEMY_DATABASE_URI="postgresql://postgres:password@localhost:5432/bdcdb" \ bdc-db db init SQLALCHEMY_DATABASE_URI="postgresql://postgres:password@localhost:5432/bdcdb" \ bdc-db db create-namespace SQLALCHEMY_DATABASE_URI="postgresql://postgres:password@localhost:5432/bdcdb" \ bdc-db db create-extension-postgis
2. After that, run BDC-DB
command to prepare the Brazil Data Cube data model:
SQLALCHEMY_DATABASE_URI="postgresql://postgres:password@localhost:5432/bdcdb" \ bdc-db alembic upgrade
3. The BDC-Catalog
uses PostgreSQL Triggers along database definition. Use the following command line to create default triggers:
SQLALCHEMY_DATABASE_URI="postgresql://postgres:password@localhost:5432/bdcdb" \ bdc-db db create-triggers
Note
You can also check the available triggers with command:
bdc-db db show-triggers Available triggers in "bdc_catalog.triggers" -> /home/user/bdc-catalog/bdc_catalog/triggers/band_metadata_expression.sql -> /home/user/bdc-catalog/bdc_catalog/triggers/collection_statistics.sql -> /home/user/bdc-catalog/bdc_catalog/triggers/timeline.sql
SQLALCHEMY_DATABASE_URI="postgresql://postgres:password@localhost:5432/bdcdb" \
bdc-db alembic upgrade
SQLALCHEMY_DATABASE_URI="postgresql://postgres:password@localhost:5432/bdcdb" \
bdc-db alembic revision "my revision" --branch=bdc_catalog
Note
Make sure to pass --branch=bdc_catalog
in order to generate the alembic migration into
the same BDC-Catalog
branch tree.