From 53ad3cf4e9b02f841fff960ec95870110f6c7bcb Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 13 Oct 2021 12:00:52 -0400 Subject: Pickling fixes for ORM / Core Fixed regression where ORM loaded objects could not be pickled in cases where loader options making use of ``"*"`` were used in certain combinations, such as combining the :func:`_orm.joinedload` loader strategy with ``raiseload('*')`` of sub-elements. Fixes: #7134 Fixed issue where SQL queries using the :meth:`_functions.FunctionElement.within_group` construct could not be pickled, typically when using the ``sqlalchemy.ext.serializer`` extension but also for general generic pickling. Fixes: #6520 Change-Id: Ib73fd49c875e6da9898493c190f610e68b88ec72 --- lib/sqlalchemy/sql/elements.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 6f1756af3..e49665019 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -4319,6 +4319,9 @@ class WithinGroup(ColumnElement): *util.to_list(order_by), _literal_as_text_role=roles.ByOfRole ) + def __reduce__(self): + return self.__class__, (self.element,) + tuple(self.order_by) + def over(self, partition_by=None, order_by=None, range_=None, rows=None): """Produce an OVER clause against this :class:`.WithinGroup` construct. -- cgit v1.2.1