designate/releasenotes/notes/Fix-metadata.bind-use-on-upgrade-3ca33425f341ac5b.yaml
Michael Johnson 0648250388 Fix DB upgrade with using SQLAlchemy 2.x
Sqlaclhemy metadata bind is deperecated from version 1.4 and will
be removed in SQLAlchemy 2.0 [1]. It can be easily replaced with
metadata reflect which works for SQLAlchemy 2.0.

Also current metadata.bind does not result in fetching all tables from
the database, so metadata.tables is an empty mapping, which leads
to db_sync failures.

[1] https://docs.sqlalchemy.org/en/14/core/metadata.html#sqlalchemy.schema.MetaData.bind
[2] https://docs.sqlalchemy.org/en/14/core/reflection.html#reflecting-all-tables-at-once

Co-Authored-By: Dmitriy Rabotyagov <noonedeadpunk@gmail.com>
Change-Id: I8c721722eeb36de64b8c8a79d4fdcec0e92388fa
2023-08-23 14:36:48 +00:00

6 lines
115 B
YAML

---
fixes:
- |
Fix an issue where on upgrade, the alembic migration will fail when using
SQLAlchemy 2.x.