From f899d7900509cbfdffdf8c48a93e908ed2249b77 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 3 Apr 2008 13:12:42 +0000 Subject: - Added some convenience descriptors to Query: query.statement returns the full SELECT construct, query.whereclause returns just the WHERE part of the SELECT construct. --- lib/sqlalchemy/orm/query.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 9751cc9ba..a2312e363 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -161,6 +161,16 @@ class Query(object): return self._session session = property(session) + def statement(self): + """return the full SELECT statement represented by this Query.""" + return self._compile_context().statement + statement = property(statement) + + def whereclause(self): + """return the WHERE criterion for this Query.""" + return self._criterion + whereclause = property(whereclause) + def _with_current_path(self, path): q = self._clone() q._current_path = path -- cgit v1.2.1