phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Van Besien <janvanbes...@gmail.com>
Subject multi tenancy
Date Fri, 22 Aug 2014 12:14:05 GMT
Hi,

I was experimenting with the Multi tenancy feature in the 4.0 branch.

The documentation mentions how to create/use tenant specific views,
which works as documented.

However, I accidentally seemed to be able to get all the features I
want without using views:

// create a driver and connect with a non tenant url
String nonTenantUrl = "jdbc:phoenix:localhost:2181";
Driver driver = DriverManager.getDriver(nonTenantUrl);
driver.connect(nonTenantUrl, new Properties());

// reuse the same driver to connect to a tenant specific url
String tenant1Url = nonTenantUrl + ";TenantId=jan";
tenant1Conn = driver.connect(tenant1Url, new Properties());

Doing this (in this order and reusing the same driver instance)
results in a tenant specific connection with the following features:

- no need to create views
- all data is transparently filtered to only return the tenant
specific data (excluding the tenant column)
- full transparent select and upsert features (I can upsert new data
through the tenant specific connection and it will automatically fill
in the tenant column visible through the non-tenant connection)
- changes in the underlying schema are possible and are reflected in
the tenant specific connection (this is not true when working with
views, I think at least the views have to be recreated)

You can also reproduce this through squirrelSQL, it reuses driver
instances as well.

Actually I prefer the undocumented behavior, mostly because of the
transparency. My question is whether this functionality is an
(unwanted) side effect of the implementation or really a feature in
the works? Given that I have to reuse a driver instance on which I
first have to create a non-tenant specific connection, I assume it is
not really how it is intended to work?

Can anyone shed some light on this topic?

Thanks in advance,
Jan

Mime
View raw message