From: Mike Bayer Date: Tue, 7 Sep 2010 15:57:19 +0000 (-0400) Subject: - pending deprecation in 0.7 for the execute/scalar on clauseelement X-Git-Tag: rel_0_6_4~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bf88fa891edfb5b42fe909c45701be510998bf6;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - pending deprecation in 0.7 for the execute/scalar on clauseelement --- diff --git a/CHANGES b/CHANGES index 5a65d046a4..777f4c6a0a 100644 --- a/CHANGES +++ b/CHANGES @@ -175,6 +175,20 @@ CHANGES NULL. - sql + - Calling execute() on an alias() construct is pending + deprecation for 0.7, as it is not itself an + "executable" construct. It currently "proxies" its + inner element and is conditionally "executable" but + this is not the kind of ambiguity we like these days. + + - The execute() and scalar() methods of ClauseElement + are now moved appropriately to the Executable + subclass. ClauseElement.execute()/ scalar() are still + present and are pending deprecation in 0.7, but note + these would always raise an error anyway if you were + not an Executable (unless you were an alias(), see + previous note). + - Added basic math expression coercion for Numeric->Integer, so that resulting type is Numeric regardless diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 76f3617a2a..b87bdc890a 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -932,7 +932,7 @@ class Mapper(object): else: return None - @util.deprecated('0.7', + @util.deprecated('0.6.4', 'Call to deprecated function mapper._get_col_to_pr' 'op(). Use mapper.get_property_by_column()') def _get_col_to_prop(self, col): diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 5235a696bb..1b1cfee8a7 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1270,8 +1270,10 @@ class ClauseElement(Visitable): else: return None - @util.deprecated("0.7", "Only SQL expressions which subclass :class:`.Executable` " - "may provide the :func:`.execute` method.") + @util.pending_deprecation('0.7', + 'Only SQL expressions which subclass ' + ':class:`.Executable` may provide the ' + ':func:`.execute` method.') def execute(self, *multiparams, **params): """Compile and execute this :class:`ClauseElement`. @@ -1287,11 +1289,13 @@ class ClauseElement(Visitable): raise exc.UnboundExecutionError(msg) return e._execute_clauseelement(self, multiparams, params) - @util.deprecated("0.7", "Only SQL expressions which subclass :class:`.Executable` " - "may provide the :func:`.scalar` method.") + @util.pending_deprecation('0.7', + 'Only SQL expressions which subclass ' + ':class:`.Executable` may provide the ' + ':func:`.scalar` method.') def scalar(self, *multiparams, **params): - """Compile and execute this :class:`ClauseElement`, returning the - result's scalar representation. + """Compile and execute this :class:`ClauseElement`, returning + the result's scalar representation. """ return self.execute(*multiparams, **params).scalar() diff --git a/lib/sqlalchemy/test/testing.py b/lib/sqlalchemy/test/testing.py index d09621dc8b..41ba3038f2 100644 --- a/lib/sqlalchemy/test/testing.py +++ b/lib/sqlalchemy/test/testing.py @@ -436,8 +436,6 @@ def resetwarnings(): # warnings.simplefilter('error') - if sys.version_info < (2, 4): - warnings.filterwarnings('ignore', category=FutureWarning) def global_cleanup_assertions(): """Check things that have to be finalized at the end of a test suite. diff --git a/test/sql/test_query.py b/test/sql/test_query.py index d78ddbb572..2093e1f69c 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -216,7 +216,7 @@ class QueryTest(TestBase): {'user_name':'jack'}, ) assert r.closed - + def test_row_iteration(self): users.insert().execute( {'user_id':7, 'user_name':'jack'},