summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
diff options
context:
space:
mode:
authorGord Thompson <gord@gordthompson.com>2020-02-13 12:14:42 -0700
committerGord Thompson <gord@gordthompson.com>2020-02-17 10:15:12 -0700
commit60f627cbd0d769e65353e720548efac9d8ab95d9 (patch)
tree2370558b27263eeeae1f6731d39d80f2483b18e0 /lib/sqlalchemy/dialects
parent3c7765b49c0aba253c11f435b2923bb488d15809 (diff)
downloadsqlalchemy-60f627cbd0d769e65353e720548efac9d8ab95d9.tar.gz
Replace engine.execute w/ context manager (step1)
First (baby) step at replacing engine.execute calls in test code with the new preferred way of executing. MSSQL was targeted because it was the easiest for me to test locally. Change-Id: Id2e02f0e39007cbfd28ca6a535115f53c6407015
Diffstat (limited to 'lib/sqlalchemy/dialects')
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py
index f900441a2..01e07729d 100644
--- a/lib/sqlalchemy/dialects/mssql/base.py
+++ b/lib/sqlalchemy/dialects/mssql/base.py
@@ -182,7 +182,8 @@ execution. Given this example::
Column('x', Integer))
m.create_all(engine)
- engine.execute(t.insert(), {'id': 1, 'x':1}, {'id':2, 'x':2})
+ with engine.begin() as conn:
+ conn.execute(t.insert(), {'id': 1, 'x':1}, {'id':2, 'x':2})
The above column will be created with IDENTITY, however the INSERT statement
we emit is specifying explicit values. In the echo output we can see