From: Mike Bayer Date: Mon, 4 Jan 2010 16:36:11 +0000 (+0000) Subject: - accept 'expire' with a deprecation warning for query.update() [ticket:1648] X-Git-Tag: rel_0_6beta1~93 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e6ba4d94264974ac0832fc24db4a48f928965fc4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - accept 'expire' with a deprecation warning for query.update() [ticket:1648] --- diff --git a/CHANGES b/CHANGES index db6a7e6735..1ea57e02e3 100644 --- a/CHANGES +++ b/CHANGES @@ -19,7 +19,8 @@ CHANGES - orm - Changes to query.update() and query.delete(): - the 'expire' option on query.update() has been renamed to - 'fetch', thus matching that of query.delete() + 'fetch', thus matching that of query.delete(). + 'expire' is deprecated and issues a warning. - query.update() and query.delete() both default to 'evaluate' for the synchronize strategy. diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 27433627be..eef60a8afa 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -1714,6 +1714,12 @@ class Query(object): #TODO: updates of manytoone relations need to be converted to fk assignments #TODO: cascades need handling. + if synchronize_session == 'expire': + util.warn_deprecated("The 'expire' value as applied to " + "the synchronize_session argument of " + "query.update() is now called 'fetch'") + synchronize_session = 'fetch' + if synchronize_session not in [False, 'evaluate', 'fetch']: raise sa_exc.ArgumentError("Valid strategies for session synchronization are False, 'evaluate' and 'fetch'") self._no_select_modifiers("update")