diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-18 15:49:14 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-18 15:49:14 +0000 |
| commit | fa56f0acb412c89a02df198a75502f59915a08bb (patch) | |
| tree | afb9d9f0889c83ab04e8e465087499cc41be599f /lib | |
| parent | 664687adb952c19d5bff731617e216f011e8e450 (diff) | |
| download | sqlalchemy-fa56f0acb412c89a02df198a75502f59915a08bb.tar.gz | |
- added test for threadlocal not supporting begin_nested()
- removed query.compile(); use explicit query.with_labels().statement instead
- moved statement annotation step upwards from query._compile_context() to outliers from_self()/statement. speeds zoomark.step_6_editing by 16%
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/orm/query.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 5df13d8d9..084f9b81d 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -304,7 +304,7 @@ class Query(object): def statement(self): """return the full SELECT statement represented by this Query.""" - return self._compile_context(labels=self._with_labels).statement + return self._compile_context(labels=self._with_labels).statement._annotate({'_halt_adapt': True}) statement = property(statement) def subquery(self): @@ -537,7 +537,7 @@ class Query(object): those being selected. """ - fromclause = self.compile().correlate(None) + fromclause = self.with_labels().statement.correlate(None) self._statement = self._criterion = None self._order_by = self._group_by = self._distinct = False self._limit = self._offset = None @@ -1240,11 +1240,6 @@ class Query(object): self.session._autoflush() return self.session.scalar(s, params=self._params, mapper=self._mapper_zero()) - def compile(self): - """compiles and returns a SQL statement based on the criterion and conditions within this Query.""" - - return self._compile_context().statement - def _compile_context(self, labels=True): context = QueryContext(self) @@ -1324,9 +1319,9 @@ class Query(object): if context.eager_order_by: statement.append_order_by(*context.eager_order_by) - - context.statement = statement._annotate({'_halt_adapt': True}) - + + context.statement = statement + return context def __log_debug(self, msg): |
