How to organise data tables for many services

Hi all,
I know that the Anvil app multiple databases.
I’m building an app that requires multiple services.
So I would like to regroup each service with its data tables without mix
How is it possible to do so?
Need help.
Thanks in advance

It is quite hard to provide any assistance with such little information. Please elaborate your issue.

In fact, you’re right.

Hi all,
I know that the Anvil app multiple databases.
I’m building an app that requires multiple services.
So I would like to regroup each service with its data tables without mix
How is it possible to do so?
The attached picture explains my idea
Need help.
Thanks in advance

Still not completely clear. But what’s the problem with a separate data table for each service?

yeah , this picture makes it perfectly clear …

2 Likes

The amount of details in the picture is so low that… that picture could be the answer itself :slight_smile:

Imagine if I gave you an answer with that very picture, would you understand?
Well, that’s what we understand from your answer.

The best way to ask a question is to show what you have done and describe the difference between what you get and what you want.

2 Likes

What you’re asking about may be feasible, depending on how easily your app can be “chopped apart”.

If some services and tables are truly independent and isolated from one another, then it might be best to make each of those services its own app. That way, it can more easily evolve at its own pace, as needed.

Service apps can communicate with each other by HTTPS, for example. Or you can treat them as dependent libraries, or packages, and incorporate them that way. Both ways are covered in the documentation, and in tutorials and/or examples.

So, it can be done. How best to do it, for any particular service, really depends on the app’s architectural needs. We don’t know any of that at this point.

All I can suggest is that you tally up those needs! If you haven’t already done so, that can clarify a lot of issues for you.

Thanks for answering first,
The problem is that all those services have to cohabit in the same app.
That’s my problem because I’m looking for the best way to do that without mixing all the concerned data tables.

Thanks, well noted.
I may take care for next.

Yeah,
Thanks for the great answer that seems to sweeten my needs. But look at this picture to clarify ideas
Regards to that picture, what architecture would you suggest to me?

About this :point_right: “Service apps can communicate with each other by HTTPS, for example. Or you can treat them as dependent libraries, or packages, and incorporate them that way. Both ways are covered in the documentation, and in tutorials and/or examples.”
Would you give me links that treat about?

Thanks in advance

Why? Are they that tightly connected to each other? That interdependent?

Edit:
From the diagram, it appears that these are not “services” in the computing sense. For example, the Windows’ print spooler runs as a service, precisely because users do not generally have to interact with it.

Instead, these appear to be “services” to the user. What would often be called “features” or “subsystems”.

And you want to keep the database tables for each “service” (group of features) separate from the other features’ tables.

How separate do they need to be? Is it enough to just give the table names distinct prefixes, e.g., Service_A_, Service_B_, … ? What kind of “separation” are you looking for? What should this separation accomplish for you?

HTTP APIs
Depending On Other Apps

But really, you should start with the links at the top of the page you’re on. Anvil’s got great documentation, tutorials, and examples. These will very likely give you ideas for handling problems you haven’t even thought of, yet.

1 Like

Yes in a large part :slightly_smiling_face:

Yes, that is. greatly thanks :slightly_smiling_face:

In fact, I thought I would do things like in Postgres or oracle, with the notion of schema.
But I realize that this is not the case with Anvil’s data tables.

However, the prefix way suits me.
Greatly appreciate your help

Finally you are giving us the first piece of information!

But it’s still not enough for us to help you.

How would you do it with postgres?

What have you tried with Anvil?

What would you expect from the result you would get with postgres that wouldn’t work with Anvil?

Great, :slightly_smiling_face:
Let’s see things in the following picture :point_right:

Considering that picture,
1- Users, depending on their needs, will first select a country (so a Database), then
2- They select a functionality (so a schema) and then
3- They follow the process until they found what they are looking for

:point_right: What I wish, is just a question of organization.
I don’t want to mix data tables of : A - X - B or A - Y - B or A - Z - B for each Database

So with Postgres or oracle, I can regroup data tables into different schema as I need :slightly_smiling_face:

So, identical schemas, with one instance of a schema per country.

Some databases handle this via “partitioning” of tables. (Like a filing cabinet; A-M in the 1st drawer, N-Z in the 2nd. You want each country in its own private “drawer”.)

If it’s a small number of instances, Anvil’s Beta IDE handles that fairly easily. Otherwise, consider alternatives, such as Anvil’s Writable Views, which let you easily define a subset of a table (e.g., where country='UK') and treat it as an independent table.

Yeah.

The solution. But I don’t know anything about that.

Idem, I don’t know anything about this

:point_right: Otherwise, by the time, i will consider the prefix option.
Thanks in advance

Anvil has excellent documentation, among the best I’ve seen. Very much worth a quick little search in there for “view”.

Well noted. Let’s keep in contact.
Thanks