This project was created to make data public for Derisk Alert app. This app is not intended for you to use in production. It's just a research project.
- python3.11
- poetry
- sqlalchemy
git clone https://github.com/CarmineOptions/derisk-research.git
cd data_handler
Create .env
file or just rename .env.example
--> .env
mv .env.example .env
DB_NAME=#
DB_USER=#
DB_PASSWORD=#
DB_HOST=db
DB_PORT=#
DERISK_API_URL=#
REDIS_HOST=redis
ERROR_CHAT_ID=# Actually your telegram id
TELEGRAM_TOKEN=#
docker-compose up -d --build
docker-compose down
In this project is using alembic
for data migrations.
Navigate to the apps
folder and generate a new migration using the following command:
cd apps
alembic -c data_handler/alembic.ini revision --autogenerate -m "your message"
After generating new migration, you need to apply it:
alembic -c data_handler/alembic.ini upgrade head
For downgrading migration:
alembic -c data_handler/alembic.ini downgrade -1
Useful commands: Purge all celery tasks:
docker-compose run --rm celery celery -A celery_app.celery_conf purge
Purge all celery beat tasks:
docker-compose run --rm celery_beat celery -A celery_app.celery_conf purge
Go to bash
docker-compose exec backend bash
- Set up
.env.dev
intoderisk-research/apps/data_handler
- Go back to
derisk-research/apps
directory - Then run bash script to migrate:
bash data_handler/migrate.sh