Is there a pythonic way to copy a row from one table and paste it in another identical table without explicitly declare each column name?

What I’m trying to do:
Copy a row from data table A and paste it identical table B without having to map each variable (long list)
What I’ve tried and what’s not working:

# this is a formatted code snippet.
app_tables.tableB.add_row(**Arow)
# paste your code between ``` 

I got this error:
TypeError: item_fn() argument after ** must be a mapping, not LiveObjectProxy

Assuming that Arow is a row of a table with the same column names as tableB, you will need to first convert the object Arow into a dict:

app_tables.tableB.add_row(**dict(Arow))

(The ** operator can’t be used with Arow even if it (almost) behave like a dict, because it is not really a dict)

3 Likes

Great :partying_face:. That saves a lot of time. Thank you so much!