So I definitely understand the data side of the target database ("A"), that
I am virtualizing.I guess more specific questions would be: * How would I expose only two tables from "A" (they would both include the tenantId field), I'm guess I might override the JdbcSchema using some whitelist. * Since I want to give everyone the same virtual table space (with different "data"), would I need to look in overriding some of the Jdbc core implementation? * I would need to use the parsed tree and then add the tenantId filter * Somehow pass in the tenantId during query time, ideally at the statement vs the connection level. Anyways, was just looking for some pointers, as there is a lot of code here. And anything would be much appreciated. I am happy to share some of the work once it's done. Thanks! -Dan On Fri, Mar 25, 2016 at 12:50 AM, Julian Hyde <[email protected]> wrote: > 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 > >
