[Accelerated Tables] fetch_only Questions

Nice!!

Riffing on this (also untested) we could use the table.list_columns() function (docs link) and some list comprehension to do it without the search. Presumably this would handle an empty table.

from anvil.tables import app_tables
from anvil.tables import query as q

def q_fetch_none_of(table, column_names_list):
  table = getattr(app_tables, table) if isinstance(table, str) else table
  table_columns = [c['name'] for c in table.list_columns()]
  column_names_list = [x for x in table_columns if x not in column_names_list]
  return q.fetch_only(*column_names_list)

I will test this tomorrow and report back

Thanks @ianb :slight_smile:

4 Likes