Best Practices Adding/Removing From DB

Right - assuming the question stays put :slight_smile:

You create a link in your snakes table to the users table, and you put the user object into that column.

So create a new column in “snakes” called “owner” and select link to table and choose Users.
Then when you create a new snake, do something like this :

me = anvil.users.get_user()
app_tables.snakes.add_row(name="python",owner=me)

Anvil maintains the link for you.

1 Like