Skip to content

Delete/rename field values #390

Answered by msiemens
AStatkus asked this question in Q&A
Apr 10, 2021 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

I think you should be able to define a custom operation like this:

def rename(from, to):
    def transform(doc):
        doc[to] = doc.pop(from, None)

    return transform

and use it just like delete('name'):

table.update(rename('old_name', 'new_name'))

Does this work for you?

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by AStatkus
Comment options

You must be logged in to vote
1 reply
@msiemens
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants