I’m trying to update a null field that is linked to the BookingTypes table row called type in the Bookings table on a self-hosted Anvil server with the following code…
import anvil.server
import anvil.tables as tables
from anvil.tables import app_tables
anvil.server.connect("XXXXXXXXX", url="wss://app.crucis.tours/_/uplink")
@anvil.server.callable
def update_booking_type():
try:
# Get the booking
booking = app_tables.bookings.get(reference="Gygn6ffbma4m")
if not booking:
return {"status": "error", "message": "Booking not found"}
else:
print(f"Booking: {booking['reference']} Type: {booking['type']}")
# Get the booking type row
booking_type = app_tables.bookingtypes.get(id='3')
if not booking_type:
return {"status": "error", "message": "Booking type not found"}
booking.update(type=booking_type)
return {
"status": "success",
"message": f"Booking {booking['reference']} updated successfully",
}
except Exception as e:
return {"status": "error", "message": str(e)}
result = update_booking_type()
print(result)
I get the error…
{'status': 'error', 'message': 'Wrong number of arguments (3) passed to anvil.private.tables.v2.row.update(). Did you pass keyword arguments as positional arguments, or vice versa?'}