Can't read a shared table between apps

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 :slight_smile:

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.
Captura de Pantalla 2021-10-08 a la(s) 13.30.00

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.

Thank you

1 Like

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?

Hi

I am focusing now in the Classic Editor.

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

1 Like

And, to confirm, can you see all the tables in the Data Tables editor in the (classic) editor?

Hy Meredydd

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.

Regards

That seems, uh, “interesting”…could you get an app into that broken state and then shoot its ID to support@anvil.works please?

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.

Thanks

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!

I already sent an email to support@anvil.works with the apps information having the issue.

1 Like

Hi @vicente.gonzalez

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 :star: 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.

I hope that helps!

2 Likes

Hi

Thank you very much, now I can read the data. I learned something new because of this unfortunate mixture I did.

Regards

1 Like

A post was split to a new topic: AttributeError: No such app table: ‘classification’