diff --git a/CHANGES.rst b/CHANGES.rst index 7321ee2c..0ae23410 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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) ------------------- diff --git a/tailbone/views/datasync.py b/tailbone/views/datasync.py index ac0fec52..b734325f 100644 --- a/tailbone/views/datasync.py +++ b/tailbone/views/datasync.py @@ -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')