How to Filter user and databases via script?

Hello everyone,

One of the user requirements for my current project is requested as folling:
let us suppose we have two databases in metabase, called dm_client1 and dm_client2, residing on two different application istances, and two external users that can access metabase from a portal. Let's call them user1 and user2.
i'd like to know whether a possibility exist, eg: through a script, to filter database available for users such as user1 will only see dm_client1 , while user2 will be filtered to see just dm_client2 and its content.

Thank you in advance

Hi @aresb
I don't quite understand your setup, but it sounds like regular data permissions:

thank you,
this works, but the main problem is that the two databases are deployed on two differents istances of metabase.
So im looking a solution to link USER1--> DATABASE1
How can i achieve this?

@aresb I don't understand. If you create user1 on metabase1, which has database1, then you just allow user1 permissions to that database.

Your two different Metabase instances have nothing in common. Even if you created the same user on both instances, the user would still be unique to that instance.

You would need to merge your two instances into one. That's a very complex task. There's tools like Serialization that can facilitate some of that work: