mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-05 22:43:15 +00:00
While answering a stackoverflow question on how to create an item but only if we don't already have an item with the same key, I realized that we never actually tested that ConditionExpressions works on key columns: all the tests we had in test_condition_expression.py had conditions on non-key attributes. So in this patch we add two tests with a condition on the key attribute. Most examples of conditions on the key attributes would be silly, but in these two tests we demonstrate how a test on key attributes can be useful to solve the above need of creating an item if no such item exists yet. We demonstrate two ways to do this using a condition on the key - using either the "<>" (not equal) operator, or the "attribute_not_exists()" function. These tests pass - we don't have a bug in this. But it's nice to have a test that confirms that we don't (and don't regress in that area). Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20200806200322.1568103-1-nyh@scylladb.com>