]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
not ready to put execution_options in the text()/select() constructors yet
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 24 Jan 2010 19:18:55 +0000 (19:18 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 24 Jan 2010 19:18:55 +0000 (19:18 +0000)
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/sql/expression.py
test/sql/test_generative.py

index d288e20c15e92c69ab2d683efd97973a9f5778a4..fff7fb9d92f02aed34960ecffb61341b61091b4c 100644 (file)
@@ -1950,7 +1950,9 @@ class Query(object):
 
             context.adapter = sql_util.ColumnAdapter(inner, equivs)
 
-            statement = sql.select([inner] + context.secondary_columns, for_update=for_update, use_labels=labels, execution_options=self._execution_options)
+            statement = sql.select([inner] + context.secondary_columns, for_update=for_update, use_labels=labels)
+            if self._execution_options:
+                statement = statement.execution_options(**self._execution_options)
 
             from_clause = inner
             for eager_join in eager_joins:
@@ -1982,9 +1984,10 @@ class Query(object):
                             for_update=for_update,
                             correlate=False,
                             order_by=context.order_by,
-                            execution_options=self._execution_options,
                             **self._select_args
                         )
+            if self._execution_options:
+                statement = statement.execution_options(**self._execution_options)
 
             if self._correlate:
                 statement = statement.correlate(*self._correlate)
index 26338359a082ccae56c2b61a0d31cb92f6e5195c..f2ad4351a2a0e2b02ef0296cd9018086db052dd3 100644 (file)
@@ -2224,14 +2224,12 @@ class _TextClause(_Executable, ClauseElement):
     _hide_froms = []
 
     def __init__(self, text = "", bind=None, 
-                    bindparams=None, typemap=None, autocommit=PARSE_AUTOCOMMIT, execution_options=None):
+                    bindparams=None, typemap=None, 
+                    autocommit=PARSE_AUTOCOMMIT):
         self._bind = bind
         self.bindparams = {}
         self.typemap = typemap
         self._autocommit = autocommit
-        self._execution_options = execution_options
-        if self._execution_options is None:
-            self._execution_options = {}
         if typemap is not None:
             for key in typemap.keys():
                 typemap[key] = sqltypes.to_instance(typemap[key])
@@ -3193,17 +3191,13 @@ class _SelectBaseMixin(_Executable):
             order_by=None,
             group_by=None,
             bind=None,
-            autocommit=False,
-            execution_options=None):
+            autocommit=False):
         self.use_labels = use_labels
         self.for_update = for_update
         self._autocommit = autocommit
         self._limit = limit
         self._offset = offset
         self._bind = bind
-        self._execution_options = execution_options
-        if self._execution_options is None:
-            self._execution_options = dict()
 
         self._order_by_clause = ClauseList(*util.to_list(order_by) or [])
         self._group_by_clause = ClauseList(*util.to_list(group_by) or [])
index 893f2abd78ec4107598ad03c857ab710b6c1e766..c31a24b93cce3ae0fc42cfa9fffe5a171994e0c7 100644 (file)
@@ -795,15 +795,17 @@ class SelectTest(TestBase, AssertsCompiledSQL):
         assert s2._execution_options == dict(foo='bar', bar='baz')
         assert s3._execution_options == dict(foo='not bar')
 
-    def test_execution_options_in_kwargs(self):
+    # this feature not available yet
+    def _NOTYET_test_execution_options_in_kwargs(self):
         s = select(execution_options=dict(foo='bar'))
         s2 = s.execution_options(bar='baz')
         # The original select should not be modified.
         assert s._execution_options == dict(foo='bar')
         # s2 should have its execution_options based on s, though.
         assert s2._execution_options == dict(foo='bar', bar='baz')
-
-    def test_execution_options_in_text(self):
+    
+    # this feature not available yet
+    def _NOTYET_test_execution_options_in_text(self):
         s = text('select 42', execution_options=dict(foo='bar'))
         assert s._execution_options == dict(foo='bar')