cosmicpython / code

Example application code for the python architecture book
Other
2.07k stars 922 forks source link

Update to SQLAlchemy 2.0 #78

Open Daniel-Faber opened 6 months ago

Daniel-Faber commented 6 months ago

The used sqlalchemy.orm.mappers are deprecated in SQLAlchemy 2.0, alongside other breaking changes fixed in this PR. Mainly we have to use sqlalchemy.orm.registry.map_imperatively instead of sqlalchemy.orm.mappers. We can also re-use the mapper_registry to replace sqlalchemy.Metadata, see the docs: https://docs.sqlalchemy.org/en/20/orm/mapping_styles.html#imperative-mapping

Full Changelog fixing all breaking changes in SQLAlchemy 2.0: