To delete items in the external database, we do exactly the same thing we’ve done for inserting, selecting
and updating - write a one-line function in inventory.py
with a simple SQL statement:
@anvil.server.callable
def delete_item(item_id):
cur.execute('''
DELETE FROM inventory WHERE id = %s;
''',
[item_id])