-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Step 1: Dump JSON from Old Database via API
- Use an API endpoint to fetch the data from old database.
- Ensure you have proper authentication token
- Save the fetched data in a JSON file.
fetch_data.py : https://github.com/nighthawkcoders/flask_2025/blob/main/scripts/fetch_data.py


Step 2: Update Schema from New Development using python db_init.py and SQLite3 Extension
- Ensure db_init.py script contains the latest schema definitions.
- Run the db_init.py script to update the SQLite database schema.
Not sure if this is completely correct, but this is a script for creating new versions of the three related tables in order to create new RDS database later on ...
db_initi.py : https://github.com/nighthawkcoders/flask_2025/blob/main/scripts/db_init.py
The schema in this file should be directly edited to make changes in schema. The other way, is to directly change the schema in the model/user.py file and rerun the init_db.py file
Step 3: Connect to RDS and Create New Database with Schema
- Connect to Your RDS Instance: Use a db client to connect to your RDS instance.
- Create a New Database: Create a new database in RDS instance.
- Apply the Schema
rds_init.py : https://github.com/nighthawkcoders/flask_2025/blob/main/scripts/rds_init.py
Step 4: Update JSON into New Database
- Read the JSON Data: Load the JSON data from the file you created in Step 1
- Connect to the New RDS Database: Establish a connection to the RDS instance where the new database is located.
- Insert Data into the New Database: Populate the new database tables with the JSON data.
update_data.py : https://github.com/nighthawkcoders/flask_2025/blob/main/scripts/update_data.py
Sciprts for migration should be run in this order :
- fetch_data.py
- db_init.py (CUSTOMIZE)
- rds_init.py (CUSTOMIZE)
- update_data.py (CUSTOMIZE BASED ON rds_init.py)