You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Andy Atj2 <an...@gmail.com> on 2014/03/29 00:46:15 UTC
Timeuuid inserted with now(), how to get the value back in Java client?
I'm writing a Java client to a Cassandra db.
One of the main primary keys is a timeuuid.
I plan to do INSERTs using now() and have Cassandra generate the value of
the timeuuid.
After the INSERT, I need the Cassandra-generated timeuuid value. Is there
an easy way to get it, without having to re-query for the record I just
inserted, hoping to get only one record back? Remember, I don't have the PK.
Eg, in every other db there's a way to get the generated PK back. In sql
it's @@identity, in oracle its...etc etc.
I know Cassandra is not an RDBMS. All I want is the value Cassandra just
generated.
Thanks,
Andy
Re: Timeuuid inserted with now(), how to get the value back in Java client?
Posted by Jonathan Ellis <jb...@gmail.com>.
Nope. Better to generate it yourself if you need it immediately.
On Mar 28, 2014 6:46 PM, "Andy Atj2" <an...@gmail.com> wrote:
> I'm writing a Java client to a Cassandra db.
>
> One of the main primary keys is a timeuuid.
>
> I plan to do INSERTs using now() and have Cassandra generate the value of
> the timeuuid.
>
> After the INSERT, I need the Cassandra-generated timeuuid value. Is there
> an easy way to get it, without having to re-query for the record I just
> inserted, hoping to get only one record back? Remember, I don't have the
> PK.
>
> Eg, in every other db there's a way to get the generated PK back. In sql
> it's @@identity, in oracle its...etc etc.
>
> I know Cassandra is not an RDBMS. All I want is the value Cassandra just
> generated.
>
> Thanks,
> Andy
>
Re: Timeuuid inserted with now(), how to get the value back in Java client?
Posted by Andrew Bruno <an...@gmail.com>.
Snowflake could be useful https://github.com/twitter/snowflake/
On Sat, Mar 29, 2014 at 10:50 AM, Michael Kjellman
<mk...@barracuda.com>wrote:
> Create a new Date() and insert that instead of using the NOW CQL macro.
> You have the time you inserted...
>
> Also, this is the type of question for the user list in the future.
>
> Hope that helps and I understood your question correctly.
>
> > On Mar 28, 2014, at 4:46 PM, "Andy Atj2" <an...@gmail.com> wrote:
> >
> > I'm writing a Java client to a Cassandra db.
> >
> > One of the main primary keys is a timeuuid.
> >
> > I plan to do INSERTs using now() and have Cassandra generate the value of
> > the timeuuid.
> >
> > After the INSERT, I need the Cassandra-generated timeuuid value. Is there
> > an easy way to get it, without having to re-query for the record I just
> > inserted, hoping to get only one record back? Remember, I don't have the
> PK.
> >
> > Eg, in every other db there's a way to get the generated PK back. In sql
> > it's @@identity, in oracle its...etc etc.
> >
> > I know Cassandra is not an RDBMS. All I want is the value Cassandra just
> > generated.
> >
> > Thanks,
> > Andy
>
> ===========================================================
>
>
>
> Find out how eSigning generates significant financial benefit.
>
> Read the Barracuda SignNow ROI whitepaper at
> https://signnow.com/l/business/esignature_roi
>
Re: Timeuuid inserted with now(), how to get the value back in Java
client?
Posted by Michael Kjellman <mk...@barracuda.com>.
Create a new Date() and insert that instead of using the NOW CQL macro. You have the time you inserted...
Also, this is the type of question for the user list in the future.
Hope that helps and I understood your question correctly.
> On Mar 28, 2014, at 4:46 PM, "Andy Atj2" <an...@gmail.com> wrote:
>
> I'm writing a Java client to a Cassandra db.
>
> One of the main primary keys is a timeuuid.
>
> I plan to do INSERTs using now() and have Cassandra generate the value of
> the timeuuid.
>
> After the INSERT, I need the Cassandra-generated timeuuid value. Is there
> an easy way to get it, without having to re-query for the record I just
> inserted, hoping to get only one record back? Remember, I don't have the PK.
>
> Eg, in every other db there's a way to get the generated PK back. In sql
> it's @@identity, in oracle its...etc etc.
>
> I know Cassandra is not an RDBMS. All I want is the value Cassandra just
> generated.
>
> Thanks,
> Andy
===========================================================
Find out how eSigning generates significant financial benefit.
Read the Barracuda SignNow ROI whitepaper at https://signnow.com/l/business/esignature_roi