Maybe you give each table a tenantId column, and give each tenant a view that adds a “WHERE tenantId = XXX”. Thus each tenant only sees its own stuff.
It could be a different view for each tenant, or it could be same view with XXX a call to a function that retrieves, say, a variable in the connect string. See https://issues.apache.org/jira/browse/CALCITE-505 <https://issues.apache.org/jira/browse/CALCITE-505>, which made views of this kind updatable. If you insert a record into such a view, the tenantId column will automatically be assigned the value XXX. Julian > On Mar 25, 2016, at 12:17 AM, Dan Di Spaltro <[email protected]> wrote: > > I'd basically like to offer some tables tenanted which, in this case, means > filtered by some tenant. How would I do that the right way in Calcite? > Obviously the tricky part is during the query execution there's no way to > pass extra variables/markers/whatever using JDBC. Which is where I'd like > to make the tenant decision (vs connection creation). > > So I was wondering if someone has some example code laying around on how to > do that, or just some general tips to get me going in the right direction. > There will be many tenants, and hopefully a reasonable amount of > connections to the db. > > > > -Dan
