Refactor Query.get() => Session.get() per SQLAlchemy 1.4

This commit is contained in:
Lance Edgar 2023-02-11 22:26:34 -06:00
parent 3d0f5ddd81
commit f6141aaf54

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2021 Lance Edgar # Copyright © 2010-2023 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -61,9 +61,9 @@ class FromRattailToWooCommerce(FromRattailConsumer):
model = self.model model = self.model
if change.payload_type == 'Product': if change.payload_type == 'Product':
return session.query(model.Product).get(change.payload_key) return session.get(model.Product, change.payload_key)
if change.payload_type == 'ProductPrice': if change.payload_type == 'ProductPrice':
price = session.query(model.ProductPrice).get(change.payload_key) price = session.get(model.ProductPrice, change.payload_key)
if price: if price:
return price.product return price.product