summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-10-05 13:59:58 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2016-10-05 16:47:31 -0400
commit71030d67bd7c7948ef4a4d868821703ef5a57476 (patch)
tree7872a83afaafc414fa13d572a634dd690f4d9824 /test/sql/test_compiler.py
parent09b685b24b19636e11169c181b45333f9739ca35 (diff)
downloadsqlalchemy-71030d67bd7c7948ef4a4d868821703ef5a57476.tar.gz
Propagate execution_options at compile stage
Compiler can now set up execution options and additionally will propagate autocommit from embedded CTEs. Change-Id: I19db7b8fe4d84549ea95342e8d2040189fed1bbe Fixes: #3805
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 6896c9857..a85786bed 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -2822,6 +2822,39 @@ class KwargPropagationTest(fixtures.TestBase):
self._do_test(c)
+class ExecutionOptionsTest(fixtures.TestBase):
+ def test_non_dml(self):
+ stmt = table1.select()
+ compiled = stmt.compile()
+
+ eq_(compiled.execution_options, {})
+
+ def test_dml(self):
+ stmt = table1.insert()
+ compiled = stmt.compile()
+
+ eq_(compiled.execution_options, {"autocommit": True})
+
+ def test_embedded_element_true_to_none(self):
+ stmt = table1.insert().cte()
+ eq_(stmt._execution_options, {"autocommit": True})
+ s2 = select([table1]).select_from(stmt)
+ eq_(s2._execution_options, {})
+
+ compiled = s2.compile()
+ eq_(compiled.execution_options, {"autocommit": True})
+
+ def test_embedded_element_true_to_false(self):
+ stmt = table1.insert().cte()
+ eq_(stmt._execution_options, {"autocommit": True})
+ s2 = select([table1]).select_from(stmt).\
+ execution_options(autocommit=False)
+ eq_(s2._execution_options, {"autocommit": False})
+
+ compiled = s2.compile()
+ eq_(compiled.execution_options, {"autocommit": False})
+
+
class CRUDTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = 'default'