-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: sqlalchemy #19
Conversation
This reverts commit 523355c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I need to run actual tests on this or you're confident enough to go with just the code review?
Good question! I'm not super confident. |
I'll try to run some tests this week then |
feat: compute process_dataset in threads
Change of plan, I won't have time to test... So let's go ahead with this making sure we have a backup plan 🤞 |
This migrates the ORM from
dataset
tosqlalchemy
.Main advantages are:
The strategy is to create an "initial migration" that provides iso-features after being applied, without the need for data migrations. I tried to create a SQLAlchemy schema that would generate a quasi-empty initial migration, but it became a game of whack-a-mole I couldn't win.
The initial migration should be applied once everywhere and then removed, it's meant to be ephemeral and does not handle the bootstrapping of an empty database (see comment in migration file).
Apart from unit tests, the migration has been validated in the following scenarios:
demo
database restored from our deployment, and subsequent load script workspython cli.py init-db
works to bootstrap an empty database, and subsequent load script worksI've compared the output of metrics computation in every scenario (this should validate quite a few things in the process chain).
On local, you should remove the
dataset
dependency, reinstallrequirements.txt
and either:ALEMBIC_ENV=(demo|prod) alembic upgrade head
to migrate an existing databasedashboard_backend
for demo anddashboard_backend_prod
for prod. This allows easy restore from our deployment. Delete your docker container to have the new databases created (you will lose your existing databases) or migrate them yourself (the Postgres version has changed too, so this will be difficult). Also remember to change your localDATABASE_URL
andDATABASE_URL_PROD
env vars values.