[Accelerated Tables] Getting Linked Column of Users Row

My understanding is that users.get_user doesn’t load and cache anything beyond the bare minimum. But then when your code gets to user_row['Linked'] it loads and caches the whole linked record, not knowing that you only intend to access ‘Some Column’. (The way the Python code works, it first processes user_row['Linked'] and then runs the ‘Some Column’ key lookup on the resulting object.)[1]

I would also like a fetch_only capability for users.get_user.

As a workaround meanwhile, you could rearrange the way your tables are organized to take advantage of the Accelerated Tables fetch_only option. Instead of storing the connection between a user and the linked record as a field in the Users table, you could instead add a ‘user’ column to the linked table and access it via app_tables.linked_table.get(user=user_row), or no?

[1] That said, I could also imagine them implementing a way to get merely a shallow reference to that linked row, without loading its content. But that doesn’t seem to be part of the plan.

edit: As a much easier workaround, something like this should work:

from anvil.tables import query as q
user_id = anvil.users.get_user().get_id()
user = app_tables.users.get_by_id(
    user_id, 
    q.fetch_only(Linked=q.fetch_only('Some_Column'))
)