Skip to main content
update(*, table_name=None, expression=None, new_values_map=None)[source]

Runs predicate-based updates in a single call. With the given expression, any matching record’s column values will be updated as provided in input parameter new_values_map.

Note that this operation can only be run on an original table and not on a result view.

Parameters

table_name (str) –

Name of table to be updated, in [schema_name.]table_name format, using standard name resolution rules. Must be a currently existing table and not a view.

expression (str) –

An actual predicate for the update; format should follow the guidelines here. The user should provide a single element (which will be automatically promoted to a list internally).

new_values_map (a dict of str to optional str) –

List of new values for the matching records. Each element is a (key, value) pair where the keys are the names of the columns whose values are to be updated; the values are the new values. The user can provide a single element (which will be automatically promoted to a list internally).

Returns

A dict with the following entries if successful–

count_updated (long) –

Total number of records updated.

In case of error it returns a dict - ‘status’ –

‘ERROR’, ‘message’: ‘Some error message’