Unable to update table via client uplink code

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?'}

I’m just guessing here, but maybe it’s because it’s getting confused by the Python type function? Since you’re only updating a single field, you can do it via booking['type']=booking_type and get around that sort of issue, if that is the case.

1 Like

What versions are you running of each? It’s possible there’s a mismatch here between anvi-uplink and the runtime server versions.

That was my original syntax with same error

anvil-uplink Version: 0.6.0
anvil-app-server Version: 1.13.4

try updating your app server to 1.14.0, i think that should fix it.