79355889

Date: 2025-01-14 17:47:44
Score: 0.5
Natty:
Report link

Untested but something like this:

from sqlalchemy import inspect
old_to_new = {c.name: k for k, c in inspect(TableName).columns.items()}

https://docs.sqlalchemy.org/en/20/orm/mapping_api.html#sqlalchemy.orm.Mapper.columns

https://docs.sqlalchemy.org/en/20/orm/mapping_styles.html#inspection-of-mapper-objects

Reasons:
  • Probably link only (1):
  • Low length (1):
  • Has code block (-0.5):
  • High reputation (-1):
Posted by: Ian Wilson