Database Deployment
The application utilizes two PostgreSQL databases, which are deployed and configured using custom Python scripts: deploy_db.py
(for the main application data) and deploy_stock_index_db.py
(for the stock ticker index).
These deployment scripts perform several key functions:
- Check Existence: They verify if the target database already exists before attempting creation.
- Create Database: If the database doesn’t exist, the script creates it.
- Create Tables: They connect to the database and create all necessary tables based on the SQLAlchemy models defined in the application.
- Enable Extensions: Essential PostgreSQL extensions, such as
pg_trgm
for trigram indexing (used in stock recommendations), are enabled to enhance database performance and functionality.
This scripted approach ensures a consistent and repeatable database setup process.