Using only_cols on linked columns

Continuing the discussion from Choose what columns are available in a Data Table View:

I attempted to apply only_cols to a linked column , following the fetch_only syntax

app_table.users.client_readable(q.only_cols("email",link=q.only_cols("link_column")))

and received the following error

TypeError: __init__() got an unexpected keyword argument 'link'

Does that mean linked columns are not supported or am I making a mistake?

2 Likes

Did you ever work this out @anthonys ?

I get the same error trying:

return app_tables.org_accounts.client_readable(q.only_cols('account_org', 'current', acc_vrn=q.only_cols('vrn'))).search(account_org = org, current = True)

I get the same error on the linked column:

TypeError: only_cols.__init__() got an unexpected keyword argument 'acc_vrn'

No, I have not, but there might have been an update since that I’ve missed. The documentation doesn’t hint to the feature being added.

I think the only work around , since it lookes like you’re on the server side and doing the search there, would be to process the data server side then return that to the client:

def server_func(org):
    data = app_tables.org_accounts.search(q.fetch_only('account_org', 'current', acc_vrn=q.fetch_only('vrn')),account_org = org, current = True)
    vrns = [{'vrn':row['acc_vrn']['vrn']} for row in data]
    return vrns

Something like that.

Looks like all you need is the account vrn from what I can discern.

yes its all server side, but thank you for the reply, much appreciated!

1 Like