Executing a Sequence

To execute the sequence we created in the previous section, use the Store.execute_updates() method:

...

def do_store_ops(store):

    try:
        store.execute_updates(op_array)
        logging.debug("Store write succeeded.")
    except IllegalArgumentException, iae:
        logging.error("Could not write table.")
        logging.error(iae.message)
        sys.exit(-1)

if __name__ == '__main__':

    ...

    add_op('PUT', 'myTable', True,
            "Hats", "baseball", "longbill",
            "red", "small", 13.07, 107)
    add_op('PUT', 'myTable', True,
            "Hats", "baseball", "longbill",
            "red", "medium", 14.07, 198)
    add_op('PUT', 'myTable', True,
            "Hats", "baseball", "longbill",
            "red", "large", 15.07, 140)

    do_store_ops(store) 

Note that if any of the above errors are thrown, then the entire sequence is aborted, and your data will be in the state it would have been in if you had never executed the sequence at all.

Store.execute_updates() can optionally take a WriteOptions object. This object allows you to specify:

For an example of using WriteOptions, see Durability Guarantees.