[Accelerated Tables] set columns for linked rows with q.only_cols

What I’m trying to do:
Return a client readable table where I restrict the columns returned both from the table in question and also restrict the allowed columns from the linked rows.

What I’ve tried and what’s not working:
I saw this post using fetch only method, but that won’t work because the q.only_cols function just takes strings and I don’t want the user to have access to certain columns in the linked rows.

 |  fetch_only(*only_cols, **linked_cols)
 |  
 |  Methods defined here:
 |  
 |  __eq__(self, other)
 |      Return self==value.
 |  
 |  __hash__(self)
 |      Return hash(self).
 |  
 |  __init__(self, *only_cols, **linked_cols)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  SERIALIZATION_INFO = ('anvil.tables.fetch_only', <class 'anvil.tables....

Digging into the documentation for the differences between only_cols and fetch_only, it seems the reason it’s possible to set a limit on the rows in fetching linked rows vs actually restricting access is there are kwargs for linked rows in fetch_only but only args for rows on the main table for only_cols in client_readable.

I don’t know if this is by design or an oversight. So I guess this should really be a bug report or feature request.

Moved to feature requests

1 Like