This is my first post after using Anvil for 3 months… I really appreciate how it has made my programming life so much easier!
I recently tried out the Accelerated Tables option with mixed results so far. When I use q.fetch_only I get the whole db row instead of just the columns I want. I have made a very simple example whereby I want to fetch 1 field from a 2 field table. You can see I am getting both fields. Hopefully I am doing something simple but wrong, and perhaps someone can set me straight…
Note that I am on the Personal plan.
Welcome to the forum!
q.fetch_only
doesn’t actually prevent you from accessing other fields, it just causes the fields you specify to be sent along with the row (pre-caching those fields). It’s purely an optimization tool. If you have a few media columns you know you won’t be accessing, you can use q.fetch_only
to not send those media columns, speeding up the transfer. But if you go ahead and access those columns anyway, Anvil will make a separate call to the server to retrieve them.
There’s a feature request around somewhere about adding in a feature that would prevent access to specific columns.
Edit: here’s the feature request if you want to like it to show support: Client-readable views on a subset of columns
2 Likes
Thank-you jshaffstall for replying so promptly! I re-read the docs with your post in mind, and see my mis-interpretation of what q.fetch_only actually does. I initially thought it would work more like the feature request you mentioned.