Next, we’ll update rows in the external database from the web app.
We need to write another function in inventory.py
- this time we’ll do an UPDATE
:
@anvil.server.callable
def update_item(item_id, name, quantity):
cur.execute('''
UPDATE inventory
SET item_name = %s, quantity = %s
WHERE id = %s;
''',
[name, quantity, item_id])