Upsert or avoid duplicate rows in data table

Is user a linked column in bot? Or are you storing an entire copy of the “user” object/row, which could be larger than say, just the users email?

If so, a text search of just the email might be faster?

There are many more things that can make it faster.

Also, look at the app tables docs for app_tables.table_name.get(), it shows you how to short circuit the or operator to get and or create a row without the if statement (and the 2 instead of one calls to .get() ) .

You can then just go:

row['url'] = url

Also the same question with bot in the documents table, if you are just comparing the row, you might want to use accelerated tables and fetch_only to not load anything except the row id inside the row object for comparison.

1 Like