Obtain the link between a Table and its linked tables

Yeah, that is what I was trying to do that was ‘slow’, only getting the used tags, and not all possible ones.
(He asked for a list so I used a set comprehension and turned it into a list)
I’m kind of confused about what @tobie.nortje is trying to accomplish, but it’s definitely not impossible.

If you want to map table id’s to their names so you can use something like

getattr(app_tables, your_table_name_here).get_columns()

to programmatically get the column names of a linked table (again unsure of the reason for needing this)

You can use some ill advised private methods that I never recommend using but they still exist:
(It’s python, you can do whatever you want, even if its a bad idea)

#regular app tables map id's to names
import json
tables_id_map = {json.loads(getattr(app_tables, x).__dict__['_spec']['id'])[0] : x for x in app_tables} 
    
#accelerated tables map id's to names
tables_id_map = { getattr(app_tables, x).__dict__['_cap'].__dict__['_scope'][2]['id']:x for x in app_tables} 

This would get you a dictionary that looks like:
{711728: 'Request_Data', 711729: 'Tag'}
Where the keys are the id’s of the tables in app_tables by name.

1 Like