summaryrefslogtreecommitdiff
path: root/tests/test_op.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-11-15 17:17:27 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-11-15 17:17:27 -0500
commitaa3551030021dd3929237444b3a6f34cc67e4213 (patch)
treed960c60b191df4634e9e4f8247602293cd650619 /tests/test_op.py
parentda8e3db9ec3ab96a1a90937a794122ea6c455548 (diff)
downloadalembic-aa3551030021dd3929237444b3a6f34cc67e4213.tar.gz
- add API support for inline literals
- push ad-hoc table/column constructs for CRUD operations - update docs to more comprehensively describe how to do CRUD in migrations
Diffstat (limited to 'tests/test_op.py')
-rw-r--r--tests/test_op.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_op.py b/tests/test_op.py
index d46f001..7503abf 100644
--- a/tests/test_op.py
+++ b/tests/test_op.py
@@ -126,4 +126,26 @@ def test_create_table_two_fk():
"FOREIGN KEY(foo_bar) REFERENCES foo (bar))"
)
+def test_inline_literal():
+ context = _op_fixture()
+ from sqlalchemy.sql import table, column
+ from sqlalchemy import String, Integer
+ account = table('account',
+ column('name', String),
+ column('id', Integer)
+ )
+ op.execute(
+ account.update().\
+ where(account.c.name==op.inline_literal('account 1')).\
+ values({'name':op.inline_literal('account 2')})
+ )
+ op.execute(
+ account.update().\
+ where(account.c.id==op.inline_literal(1)).\
+ values({'id':op.inline_literal(2)})
+ )
+ context.assert_(
+ "UPDATE account SET name='account 2' WHERE account.name = 'account 1'",
+ "UPDATE account SET id=2 WHERE account.id = 1"
+ )