This involves some refactoring and updates on almost all chapters. Not sure what is the path (update the book first or the branches). I am available to help.
from sqlalchemy.orm import registry
mapper_registry = registry()
order_lines = Table(
"order_lines",
mapper_registry.metadata,
Column("id", Integer, primary_key=True, autoincrement=True),
Column("sku", String(255)),
Column("qty", Integer, nullable=False),
Column("orderid", String(255)),
)
def start_mappers():
mapper_registry.map_imperatively(model.OrderLine, order_lines)
...
registry.map_imperatively()should be used instead.Reference: https://docs.sqlalchemy.org/en/14/orm/mapping_api.html?highlight=mapper#sqlalchemy.orm.mapper
This involves some refactoring and updates on almost all chapters. Not sure what is the path (update the book first or the branches). I am available to help.
What needs to be done:
mapper_registry.metadatainstead ofmetadata. Eg.:mapper_registry.map_imperativelyinstead ofmapper. Eg.: