Automatically allow access to data tables in dependencies

When you add an app as a dependency, it should automatically allow access to that dependency’s data tables without having to manually add them to the app that is relying on the dependency.

Are you talking about copying the structure of the data tables to the new app? Or actually having the new app use the data tables inside the dependency?

The first sounds like a great feature, the second would mix data from all the dependent apps. That might be what you want, but there should probably be an option to do either/or since it wouldn’t work in all situations.

1 Like

I have a dependency with its own test database(s). I certainly wouldn’t want my test data showing up in a real app.

On the other hand, it could be very handy to have the test database schema (table structure) available, to replicate into the Apps that use the dependency.

1 Like

I agree, more than once I had to clone a project mostly because I wanted it’s database structure, just to remove everything else and clear all rows. I just wanted to have the exact same structure in a somewhat different app.

I also have cases where I wouldn’t want to mix the test data or even real data from an app that I use as dependency in another one.

However, I can actually see his case since there are some uses. I have a project that it’s entire purpose is to be a central dependency for all my apps. I have a few data tables there that are generic and serve purpose to all apps that depend on it. I, of course, share those tables in each app that needs it, but it would be cool to have an option to, not automatically include/import, but to access like dependency.app_tables or something. This would make the dependency work more towards a all-included extension. It’s similar to an old request for the assets to also be inherited from dependencies.

1 Like

Agree completely.

Anvil currently lets us do all of these things. That is the best possible outcome.

The trick is, to do it well, we currently have to track every table, and every usage of every table, in every database, in every App, ourselves. There’s no central lookup point in our account, listing our account’s every table, every database, and every table’s usages. (But I’ve asked for that in its own Feature Request.)

1 Like

My meaning was indeed to have the data tables with their data available to the app that’s using the dependency.

I can see the argument for having a setting in the dependency as to whether to copy just the structure or the data as well.

And if your Dependency has multiple Databases – e.g., test vs. production – it should be possible to specify which.

Who gets to choose? The Dependency-supplier, or the Dependency-user? There are cases for each.

1 Like

I think it’s safest if the dependency supplier gets to allow it or disallow it (for example for 3rd party dependencies) and if the supplier allows it, the user can either enable or disable it.

or maybe even just enable disable on the user side and only allow it for dependencies that you control? (no clue if that’s feasible with self hosting the server though)

1 Like