Getting list of table names/ Getting origin table of row object

Hi, i am working on a project where i need to figure out what data table a row object originates from.

In my mind there are two different approaches:

  1. Get the origin table directly from the row object

  2. Get a list of tables, and check what table the row object is present in

The issue is, that i have not been able to find any method of doing either of the two approaches. In fact, i have not found any way to get any table name from code.

In my search i have used the dir() method on AppTables objects and and row objects, to see if any methods not described in the documentation could be used to get information that could be used. I sadly couldn’t find anything usefull.

So to summarize my question, does anyone know how to either a) get a list of table names, or b) get the origin table from a row object? If neither is possible, is it due to something more technical, or is it just because Anvils data table system hasn’t been developed with this functionality in mind?

Thanks in advance for any help

This shows one way to

Table names are recorded explicitly in your app’s Database Schema. Here’s one way to get that information, and more:

You can find table ids in exported_table_schema. Check these against the row’s id, and you should spot a pattern.

This correspondence is also undocumented, and subject to change without notice. So I wouldn’t rely on either one for too long. You may want to add your own bookkeeping columns, if you need to.

1 Like

Thanks, ill try this out