]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Added some convenience descriptors to Query:
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 3 Apr 2008 13:12:42 +0000 (13:12 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 3 Apr 2008 13:12:42 +0000 (13:12 +0000)
query.statement returns the full SELECT construct,
query.whereclause returns just the WHERE part of the
SELECT construct.

CHANGES
lib/sqlalchemy/orm/query.py

diff --git a/CHANGES b/CHANGES
index 70ca76c30738a995ca74c4571c007ba1417b7c6d..2f30c883cf7cd02e5acd718d547d7f19e390703b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -105,6 +105,11 @@ CHANGES
     - query.order_by() and query.group_by() will accept multiple
       arguments using *args (like select() already does).
 
+    - Added some convenience descriptors to Query: 
+      query.statement returns the full SELECT construct,
+      query.whereclause returns just the WHERE part of the
+      SELECT construct.
+
     - Fixed/covered case when using a False/0 value as a
       polymorphic discriminator.
 
index 9751cc9ba28a18f018e5217dcfe6309f39368147..a2312e3633d7abf7e15786897873fa4a0c5b658c 100644 (file)
@@ -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