Passing DB rows between callable server functions

I don’t know the details.

Here we are dealing with the magic of anvil.server.call() and the magic of row objects, and I don’t know the details of what affects what.

Row objects try to minimize the number of round trips, the number of interactions with the database and the amount of data they store and transfer between server and client. These things are in conflict: you could get lots of data in one db interaction and in one round trip, but you may end up transferring hundreds of megabytes when you need just a few bytes. So Anvil tries its best guessing what you need.

In this case it could find the 555 because the data column is of simple object type (is it?) and it is not automatically serialized with the row object, in the attempt not to transfer too much data. Later, when it finds entry['data'] it decides it’s time to get the content of the data column and does the round trip to fetch it.

I’m just guessing, I might be wrong in how the details work, but the concept should be close enough.

Not knowing and not having control over these details, together with a negative effect on performances, is why I never use row objects on the client side. I always create a dictionary with all and only the values I need and I send that to the client.

1 Like