Hi, currently I have a table which records information for multiple customers. In the table, there is a tenant_id column which differentiate which tenant we are serving. Now I want to create an account or maybe multiple accounts for each tenant. Each tenant should be able to view only his/her data.
I came up with two ways to solve this problem. The first is to use row level access for data source, which seems not applicable for now? The second is, to create another table which maps user_id from Redash, to tenant_id in my data table. And when doing SQL queries, I can query like:
SELECT * FROM data_table JOIN map_table
WHERE
data_table.tenand_id = map_table.tenant_id
AND
map_table.user_id = current_login_user_id;
The SQL query may be wrong but hope you can get my idea . Is this possible? Or, is there other ways to solve my problem? Thanks!
UPDATE: In short, we hope to realize the scene, multiple users use the same data source, access to the same dashboard. But based on their login user_id, SQL queries use different conditions and different contents are provided.