I want to read 2 data tables from an app A in an app B. I add the shared the tables using the classic editor in the app B so I can see them. When I try to read it by code I get
AttributeError: No such app table: 'table_name'
at /downlink/anvil/tables/__init__.py:20
I try to read the information using a Server code:
app_tables.table_name.search()
When I switch to the new Beta Editor in the database section I see âSystem Mismatchâ Your App is expecting a schema that does not match this database.
In the Classic Editor I can see the tables and the data in the Defauls database section.
How can I fix it? I donât want to corrupt the data tables making some wrong change.
As I guess you saw in the other thread, the Beta editor is limited, at this point, in its handling of shared tables. So (Iâm just guessing) itâs probably better to focus on whatâs going on in the Classic editor?
One thing Iâm seeing in the docs is that, when you share tables between apps, the âPython nameâ of a table can be different for each app with which it is shared. Are you sure that table_name is the Python name of the table in the app with that Server code?
The table name in the server code is the right one. I know that because when I write app_tables. the autocomplete show me the name of the 2 data tables shared. then I choose one of them. But when I run my code I get:
AttributeError: No such app table: âtable_nameâ
at /downlink/anvil/tables/init.py, line 20
Yes I could see the tables in the classic editor but can`t read them by code. After many tries of sharing the tables I decided to use http_endpoint by now.
I remember after many tries of sharing the table I couldn`t even read the tables of my own new app, so I drop the Data Tables service and add it again and I could even read the own app tables.
I will try to build 2 example apps with the issue, by now the problem is present sharing tables of an app built months ago that is in production so I donât want to move that more.
If itâs a production app, we can do a nondestructive inspection of whatâs going on, but I would really like to be able to take a look at it â if this is a Data Tables bug, we want to squash it fast!
It looks like you have created a second database using the Beta Editor, and you are using that as your development database (it has the icon). This will confuse the Classic Editor, which will only show tables from the default database. So, in the Beta Editor, click the three dots next to Default Database and choose âUse for developmentâ - that should make the Classic Editor work again.
As @hugetim mentioned above, support for sharing tables is limited in the Beta Editor right now, and the Classic Editor does not support multiple databases. What you had here was an unfortunate combination of both! If you wish to continue to use the Classic Editor, you must make sure that the Default Database is always selected in the Beta Editor.