feat: add Python migration script and successfully test SQLite to PostgreSQL data migration
- Created scripts/migrate-sqlite-to-postgres.py as alternative to TypeScript version - Handles all type conversions: timestamps, booleans, and JSONB fields - Successfully migrated all 2,836 rows from SQLite to PostgreSQL - Verified data integrity: all 6 tables migrated correctly - Charts: 1, Candles: 2,592, Annotations: 4, Span annotations: 223
This commit is contained in:
parent
5f70f13da3
commit
bfe437857b
9 changed files with 1080 additions and 20 deletions
|
|
@ -27,22 +27,22 @@
|
|||
|
||||
## 5. Docker and Deployment
|
||||
|
||||
- [ ] 5.1 Update `docker-compose.yml` — rename `POSTGRES_DB` to `candle_annotator`, add `DATABASE_URL` env to candle-annotator service, add `depends_on: postgres` with health check condition
|
||||
- [ ] 5.2 Remove `candle-data` volume from `docker-compose.yml` (SQLite volume)
|
||||
- [ ] 5.3 Update `Dockerfile` if it references SQLite or `DATABASE_PATH`
|
||||
- [ ] 5.4 Update ML service database connection — change database name from `ml_db` to `candle_annotator` in environment config
|
||||
- [x] 5.1 Update `docker-compose.yml` — rename `POSTGRES_DB` to `candle_annotator`, add `DATABASE_URL` env to candle-annotator service, add `depends_on: postgres` with health check condition
|
||||
- [x] 5.2 Remove `candle-data` volume from `docker-compose.yml` (SQLite volume)
|
||||
- [x] 5.3 Update `Dockerfile` if it references SQLite or `DATABASE_PATH`
|
||||
- [x] 5.4 Update ML service database connection — change database name from `ml_db` to `candle_annotator` in environment config
|
||||
|
||||
## 6. ML Service Direct Data Access
|
||||
|
||||
- [ ] 6.1 Add SQLAlchemy table reflections or raw queries in the ML service for reading `candles`, `annotations`, `span_annotations`, `charts` tables
|
||||
- [ ] 6.2 Update ML training pipeline to query candle/annotation data from PostgreSQL instead of CSV/JSON exports
|
||||
- [ ] 6.3 Remove or deprecate any CSV/JSON export code paths that are no longer needed
|
||||
- [x] 6.1 Add SQLAlchemy table reflections or raw queries in the ML service for reading `candles`, `annotations`, `span_annotations`, `charts` tables
|
||||
- [x] 6.2 Update ML training pipeline to query candle/annotation data from PostgreSQL instead of CSV/JSON exports
|
||||
- [x] 6.3 Remove or deprecate any CSV/JSON export code paths that are no longer needed
|
||||
|
||||
## 7. Data Migration Script
|
||||
|
||||
- [ ] 7.1 Create `scripts/migrate-sqlite-to-postgres.ts` — read all 6 tables from SQLite, apply type conversions (timestamps, booleans, JSON→jsonb), insert into PostgreSQL
|
||||
- [ ] 7.2 Make the script idempotent (skip or clear+re-insert with flag)
|
||||
- [ ] 7.3 Test migration script with existing SQLite data
|
||||
- [x] 7.1 Create `scripts/migrate-sqlite-to-postgres.ts` — read all 6 tables from SQLite, apply type conversions (timestamps, booleans, JSON→jsonb), insert into PostgreSQL
|
||||
- [x] 7.2 Make the script idempotent (skip or clear+re-insert with flag)
|
||||
- [x] 7.3 Test migration script with existing SQLite data
|
||||
|
||||
## 8. Testing and Verification
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue