Fix raw query to avoid SQLAlchemy 2.x warnings

This commit is contained in:
Lance Edgar 2024-04-16 23:29:56 -05:00
parent 7fa39d42e2
commit e82f0f37d8
2 changed files with 9 additions and 7 deletions

View file

@ -7,6 +7,8 @@ Unreleased
* Fix ASGI websockets when serving on sub-path under site root.
* Fix raw query to avoid SQLAlchemy 2.x warnings.
0.9.94 (2024-04-16)
-------------------

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar
# Copyright © 2010-2024 Lance Edgar
#
# This file is part of Rattail.
#
@ -30,7 +30,7 @@ import logging
import sqlalchemy as sa
from rattail.db import model
from rattail.db.model import DataSyncChange
from rattail.datasync.util import purge_datasync_settings
from rattail.util import simple_error
@ -71,7 +71,7 @@ class DataSyncThreadView(MasterView):
]
def __init__(self, request, context=None):
super(DataSyncThreadView, self).__init__(request, context=context)
super().__init__(request, context=context)
app = self.get_rattail_app()
self.datasync_handler = app.get_datasync_handler()
@ -106,7 +106,7 @@ class DataSyncThreadView(MasterView):
from datasync_change
group by source, consumer
"""
result = self.Session.execute(sql)
result = self.Session.execute(sa.text(sql))
all_changes = {}
for row in result:
all_changes[(row.source, row.consumer)] = row.changes
@ -368,7 +368,7 @@ class DataSyncChangeView(MasterView):
"""
Master view for the DataSyncChange model.
"""
model_class = model.DataSyncChange
model_class = DataSyncChange
url_prefix = '/datasync/changes'
permission_prefix = 'datasync_changes'
creatable = False
@ -390,7 +390,7 @@ class DataSyncChangeView(MasterView):
]
def configure_grid(self, g):
super(DataSyncChangeView, self).configure_grid(g)
super().configure_grid(g)
# batch_sequence
g.set_label('batch_sequence', "Batch Seq.")
@ -404,7 +404,7 @@ class DataSyncChangeView(MasterView):
return kwargs
def configure_form(self, f):
super(DataSyncChangeView, self).configure_form(f)
super().configure_form(f)
f.set_readonly('obtained')