Re: Define parameters in queries

2017-03-23 Thread Cheyenne Forbes
or should I say "declare variables in Phoenix" instead of "defining
variables in Phoenix"?


Re: Define parameters in queries

2017-03-23 Thread Cheyenne Forbes
Can you show me an example of defining variables in Phoenix (not send a
parameter)? I am getting errors, how would I do this in phoenix:
*@my_variable := CASE WHEN my_column IS NULL THEN "this value" ELSE "that
value" END*


Re: python-phoenixdb

2017-03-23 Thread James Taylor
Thanks, Dimitri! If you're interested, I think the community would welcome
this as a contribution to Apache Phoenix so it can appear in our regular
distributions.

Regards,
James

On Thu, Mar 23, 2017 at 5:21 PM, Dimitri  wrote:

> Hi,
>
> I make some update on my fork of Lukáš Lalinský phoenix python lib.
>
> I integrate sqlalchemy and correct some bug.
>
> you can find the code source on https://github.com/Pirionfr/pyPhoenix
> and it's available in https://pypi.python.org/pypi/pyPhoenix
>
> regards
> Dimitri Capitaine
>
>
>
>
>
>
>
> 2016-11-07 18:12 GMT+01:00 Josh Elser :
>
> > +1
> >
> > I was poking around with it this weekend. I had some issues (trying to
> use
> > it from the Avatica side, instead of PQS, specifically), but for the most
> > part it worked. Definitely feel free to report any issues you run into:
> > https://bitbucket.org/lalinsky/python-phoenixdb. It would be nice to
> make
> > this a "first-class citizen".
> >
> > James Taylor wrote:
> >
> >> Thanks, Dimitri. I created PHOENIX-3459 to update the website with the
> new
> >> link. It'd be great to see this make it into Phoenix proper (or Avatica
> or
> >> a combination of the two).
> >>
> >>  James
> >>
> >> On Sun, Nov 6, 2016 at 12:35 PM, Dimitri  wrote:
> >>
> >> erratum
> >>> Someone else did the port to protobuf, Lukáš Lalinský merged the pull
> >>> request and it's now released as version 0.5.
> >>>
> >>> Dimitri
> >>>
> >>> 2016-11-03 22:14 GMT+01:00 Dimitri:
> >>>
> >>> Hi,
> 
>  Lukáš Lalinský is no longer use Phoenix, so he is not actively working
>  on
>  his lib anymore.
> 
>  One major problem with his lib is that it uses the JSON interface,
> which
>  is now deprecated.
> 
>  I fork it for my use (phoenix 4.8 and sqlalchemy.), it's now use
>  protobuf,I push my code on my github. (https://github.com/Pirionfr/
>  python-phoenixdb)
> 
>  For some who want to use it can you put the link on your site (
>  https://phoenix.apache.org/phoenix_python.html) ?
> 
> 
> 
> 
> >>
>


[ANNOUNCE] Apache Phoenix 4.10 released

2017-03-23 Thread James Taylor
The Apache Phoenix team is pleased to announce the immediate availability
of the 4.10.0 release. Apache Phoenix enables SQL-based OLTP and
operational analytics for Hadoop using Apache HBase as its backing store
and providing integration with other projects in the ecosystem such as
Spark, Hive, Pig, Flume, and MapReduce. The 4.x releases are compatible
with HBase 0.98/1.1/1.2.

Highlights of the release include:

* Reduce on disk footprint through column encoding and optimized storage
format for write-once data [1]
* Support Apache Spark 2.0 in Phoenix/Spark integration [2]
* Consume Apache Kafka messages through Phoenix [3]
* Improve UPSERT SELECT performance by distributing execution across
cluster [4]
* Improve Hive integration [5]
* 40+ bug fixes [6]

Source and binary downloads are available here [7].

Thanks,
The Apache Phoenix Team

[1] https://blogs.apache.org/phoenix/entry/column-mapping-and-immutable-data
[2] https://phoenix.apache.org/phoenix_spark.html
[3] https://phoenix.apache.org/kafka.html
[4] https://issues.apache.org/jira/browse/PHOENIX-3271
[5] https://issues.apache.org/jira/browse/PHOENIX-3346
[6]
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12315120version=12338126
[7] http://phoenix.apache.org/download.html


Re: Define parameters in queries

2017-03-23 Thread Will Xu
Yes, it will work.


Pure JDBC only supports index, not named parameters. Named parameter (:userId) 
is not part of Java. There are third party libraries supporting it.

http://www.javaworld.com/article/2077706/core-java/named-parameters-for-preparedstatement.html


Regards,

Will


From: Cheyenne Forbes 
Sent: Thursday, March 23, 2017 1:27 PM
To: user@phoenix.apache.org
Subject: Re: Define parameters in queries

Will I be able to change the value of userId from in the query?
:userId = CASE WHEN userId > 10 THEN userId ELSE (userId + 1) END


Re: Define parameters in queries

2017-03-23 Thread Cheyenne Forbes
Will I be able to change the value of userId from in the query?
*:**userId = CASE WHEN **userId > 10 THEN **userId ELSE **(userId + 1) END*


Re: Define parameters in queries

2017-03-23 Thread Will Xu
?Hi Cheyenne,

Phoenix connections are standard JDBC connections. This means you can use 
prepareStatement API to do parameter substitution.


>From SO: 
>http://stackoverflow.com/questions/12745186/passing-parameters-to-a-jdbc-preparedstatement


   statement =con.prepareStatement("SELECT * from employee WHERE  userID = 
:userId");
   statement.setString(userId, userID);
   ResultSet rs = statement.executeQuery();

Or, you can use ? in place of named value - :userId..

   statement =con.prepareStatement("SELECT * from employee WHERE  userID = ?");
   statement.setString(1, userID);?


  ResultSet rs = statement.executeQuery();

Regards,

Will


From: Cheyenne Forbes 
Sent: Thursday, March 23, 2017 10:50 AM
To: user@phoenix.apache.org
Subject: Re: Define parameters in queries

Anyone?


Re: Define parameters in queries

2017-03-23 Thread Cheyenne Forbes
Anyone?