Skip to content
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

Unfreeze SQLAlchemy #252

Closed
wants to merge 13 commits into from
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ toolz
pyyaml
importlib_metadata
pymysql
sqlalchemy==1.3.*
Copy link
Member

@northwestwitch northwestwitch May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sqlalchemy 2 can be quite different from v.1, there is even a migration guide: https://docs.sqlalchemy.org/en/20/changelog/migration_20.html

Just unfreezing like this seems risky..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I realised a little while ago. 😊 It was useful to test the dependencies at least: nice to see that chanjo-report / scout did build and run ok with this configuration. But chanjo would likely bug out without changes..

sqlalchemy<2.0
6 changes: 3 additions & 3 deletions tests/store/test_store_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from datetime import datetime

import pytest
from sqlalchemy.orm.exc import FlushError
from sqlalchemy.exc import IntegrityError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯


from chanjo.store.api import ChanjoDB
from chanjo.store.models import Sample
Expand Down Expand Up @@ -38,8 +38,8 @@ def test_save(chanjo_db):
# GIVEN sample already exists
conflict_sample = Sample(id=sample_id, group_id="ADMG2")
# WHEN saving it again with same id
# THEN error is raised _after_ rollback
with pytest.raises(FlushError):
# THEN an error is raised
with pytest.raises(IntegrityError):
chanjo_db.add(conflict_sample)
chanjo_db.save()

Expand Down
Loading