本文整理匯總了Python中cqlengine.statements.UpdateStatement.update_context_id方法的典型用法代碼示例。如果您正苦於以下問題:Python UpdateStatement.update_context_id方法的具體用法?Python UpdateStatement.update_context_id怎麽用?Python UpdateStatement.update_context_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cqlengine.statements.UpdateStatement
的用法示例。
在下文中一共展示了UpdateStatement.update_context_id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_context_update
# 需要導入模塊: from cqlengine.statements import UpdateStatement [as 別名]
# 或者: from cqlengine.statements.UpdateStatement import update_context_id [as 別名]
def test_context_update(self):
us = UpdateStatement("table")
us.add_assignment_clause(AssignmentClause("a", "b"))
us.add_assignment_clause(AssignmentClause("c", "d"))
us.add_where_clause(WhereClause("a", EqualsOperator(), "x"))
us.update_context_id(3)
self.assertEqual(unicode(us), 'UPDATE table SET "a" = :4, "c" = :5 WHERE "a" = :3')
self.assertEqual(us.get_context(), {"4": "b", "5": "d", "3": "x"})
示例2: test_context_update
# 需要導入模塊: from cqlengine.statements import UpdateStatement [as 別名]
# 或者: from cqlengine.statements.UpdateStatement import update_context_id [as 別名]
def test_context_update(self):
us = UpdateStatement('table')
us.add_assignment_clause(AssignmentClause('a', 'b'))
us.add_assignment_clause(AssignmentClause('c', 'd'))
us.add_where_clause(WhereClause('a', EqualsOperator(), 'x'))
us.update_context_id(3)
self.assertEqual(six.text_type(us), 'UPDATE table SET "a" = %(4)s, "c" = %(5)s WHERE "a" = %(3)s')
self.assertEqual(us.get_context(), {'4': 'b', '5': 'd', '3': 'x'})