I’m planning to connect Metabase to a Microsoft SQL Server database but I would like to enforce my own permission model. Therefore I’m considering to create my own custom driver for this, but would like to ask if you think that is feasible or not?
I have looked at the “Data Sandbox” feature, but that doesn’t solve all my needs since I need to dynamically calculate the permission before each query is executed.
This is how I’m planning to build the driver:
- Create a custom driver that wraps the sqlserver driver.
- Override the actual “execute query”.
- Run custom sql queries to build the permission model.
- Append an extra
where statementto the MBQL query sent from Metabase.
- Execute the query
Do you think this would work? And how much work do you think it would be? When I read the docs I get a feeling that it should be pretty straight forward to do.
I also wonder if I can get hold of the UserID in my custom driver? Could I perhaps extract it from the MBQL query sent from Metabase?
Thanks in advance, Jens