Skip to content

Conversation

Daniel-Faber
Copy link
Contributor

@Daniel-Faber Daniel-Faber commented Dec 8, 2023

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:

  • Use sqlalchemy.sql.text when running sqlalchemy.orm.session.execute
  • Convert rows to dicts via row._asdict() instead of dict(r)
  • Use sqlalchemy.orm.registry.map_imperatively instead of sqlalchemy.orm.mappers
  • Optional: Use sqlalchemy.orm.registry.metadata instead of sqlalchemy.Metadata

hjwp added 30 commits February 23, 2021 16:37
@Daniel-Faber Daniel-Faber closed this by deleting the head repository Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants