Hi Nico,

Judging by that snippet above, it looks like you're actually using Spark's
native JDBC integration though the regular Phoenix driver to create your
source dataframe, not the spark-phoenix integration at all [1].

If that's sufficient for you, I suspect you can also use the DataFrame JDBC
write() method, as per [2].

FWIW, internally when using the phoenix-spark integration, we just pass the
tenantID manually as part of the predicate, since our analytics layer is
aware of all tenants.

Good luck,

Josh

[1] https://phoenix.apache.org/phoenix_spark.html
[2] http://stackoverflow.com/a/32625114

On Fri, Oct 7, 2016 at 1:14 PM, James Taylor <[email protected]> wrote:

> Not sure if the phoenix-spark integration propagates connection properties,
> but an alternate way of specifying the tenant ID is through that mechanism
> (which would workaround the URL building issue).
>
> On Fri, Oct 7, 2016 at 10:06 AM, Nico Pappagianis <
> [email protected]> wrote:
>
> > Hi James,
> > At first I thought it was the dataframe vs rdd implementations but
> looking
> > closer my bet is the way spark connects to phoenix. When reading via
> > SqlContext I pass in
> >
> > "url" -> "jdbc:phoenix:zkHost1, zkHost2, zkHost3:zkPort;TenantId=
> > 123456789"
> > and it connects as the tenant.
> >
> > However SqlContext does not have a write/save function.
> >
> > When I try to save by other means I am required to pass in a value for
> > "zkUrl" (not "url"). "zkUrl" cannot have the "jdbc:phoenix:" portion
> > attached (because it attaches zkPort to the end of jdbc:phoenix and
> errors
> > out). As such I cannot connect as the tenant.
> >
> > When connecting as the tenant via squirrel client I use the same "url"
> > string above, and it works.
> >
> > So to me it appears to be an issue of how to connect to phoenix as the
> > tenant via spark/phoenix-spark integration. I have not found a clear cut
> > way to do so.
> >
> >
> > Thanks,
> > -Nico
> >
> >
> > On Fri, Oct 7, 2016 at 9:03 AM, James Taylor <[email protected]>
> > wrote:
> >
> > > Hi Nico,
> > > You mentioned offline that it seems to be working for data frames, but
> > not
> > > RDDs. Can you elaborate on that? Have you confirmed whether the
> TenantId
> > > connection property is being propagated down to the Phoenix connection
> > > opened for the Spark integration?
> > > Thanks,
> > > James
> > >
> > > On Thu, Oct 6, 2016 at 8:36 PM, Nico Pappagianis <
> > > [email protected]> wrote:
> > >
> > > > Does phoenix-spark integration support multitenancy? I'm having a
> hard
> > > time
> > > > getting it working on my tenant-specific view.
> > > >
> > > > Thanks
> > > >
> > >
> >
>

Reply via email to