RepoDB icon indicating copy to clipboard operation
RepoDB copied to clipboard

Enhancement: Dynamic Postgres Schema

Open TimCorwin opened this issue 4 years ago • 1 comments

Describe the enhancement

My organization uses postgres Schemas for tenant isolation.

As such, we need to be able to dynamically connect to a requested schema; when using raw npgsql, we can just add SearchPath=tenant, and interact with tables directly. because this changes the connection string it forces npg to pool the connection properly.

However, going through RepoDb, we hit PostgreSqlDbHelper.GetFields, which explicitly retrieves the schema from the table attribute or static value on DbSettings.

That means if I've set the searchPath to something other than public, it will still look for the fields in public, find nothing, and throw.

if it was possible to provide an instance rather than static value of the schema, it would be possible to pass or set the desired schema when constructing Repositories.

TimCorwin avatar Jan 11 '21 20:01 TimCorwin

Thanks for reporting and also for explaining your situation/problem. We will do assess and look for the ways on how to solve this in the near future.

mikependon avatar Jan 11 '21 21:01 mikependon