Multi-tenancy with one db schema per tenant

We have a SasS project with a multi-tenant setup, so each tenant has its own postgres database, but hosted on the same server.
What is the best way to provide them access to the data, in terms of data source configuration?

Hi @lirimici
Have you looked at this?
https://www.metabase.com/learn/permissions/multi-tenant-permissions

Hi @flamber, I slipped a mistake in my initial message. We have a database per tenant.
I assume we need to create a datasource per tenant.
Our end goal is to provide access to the same dashboards, but only the databases would differ for each tenant.

Also, is there an api to do this programatically, as we can constantly add new tenants on the fly?

@lirimici The easiest way would be to consolidate all your databases in one warehouse, but otherwise yes, you would have to create a connection for each.

There's Serialization to duplicate environments more easily:
https://www.metabase.com/docs/latest/enterprise-guide/serialization.html

And there's an API to do everything you can do in the Metabase interface:
https://www.metabase.com/docs/latest/api-documentation.html