Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 429FA10CEA for ; Tue, 1 Apr 2014 17:54:21 +0000 (UTC) Received: (qmail 90872 invoked by uid 500); 1 Apr 2014 17:54:18 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 89834 invoked by uid 500); 1 Apr 2014 17:54:16 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 89817 invoked by uid 99); 1 Apr 2014 17:54:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2014 17:54:14 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mishra.vivs@gmail.com designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-ob0-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2014 17:54:10 +0000 Received: by mail-ob0-f175.google.com with SMTP id uy5so11330192obc.34 for ; Tue, 01 Apr 2014 10:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ER6YudsElkBgZ5MeNQXG0dBxMVpasZNZmy2q7vYaDLs=; b=t6i/8l5fLE0MZ626nSFzWvVZ37do4N4XGHu7iI4Ve/B3AkHT0QRp6BW0p3BM3VY76a WlTUz9x3PLYadBrzzD7rIsT0Ig7/+3/i6vpBoUib9wDTUaxlFoDP+pZ69LHg3vKipvvx y6Zv4ZQSxeesQtUOd1l4NDyAMdhfImvLMJDjotIToVwTanigmKRRKV0x8gaHoXzqGePm CWPcj/L0U6tYn5QMITbCl0D2ccl7b4dq3Mivg+Sfmg9F6jTZwR0mzc5F9GWM01PQgK6D ZclPdnTa2TeQ9iIDZnC5LRF8+bZOo2rgjxU1kFYSpvHy5eQnRQ1mkkayPKmzUY5MHwTx 58Jw== MIME-Version: 1.0 X-Received: by 10.182.42.3 with SMTP id j3mr29410779obl.30.1396374829657; Tue, 01 Apr 2014 10:53:49 -0700 (PDT) Received: by 10.182.75.228 with HTTP; Tue, 1 Apr 2014 10:53:49 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 Apr 2014 23:23:49 +0530 Message-ID: Subject: Re: Timeuuid inserted with now(), how to get the value back in Java client? From: Vivek Mishra To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=f46d044786ddb1f38004f5fed9a9 X-Virus-Checked: Checked by ClamAV on apache.org --f46d044786ddb1f38004f5fed9a9 Content-Type: text/plain; charset=ISO-8859-1 You would get UUID object from cassandra API. Then you may use uuid.timestamp() to get time stamp for the same -Vivek On Tue, Apr 1, 2014 at 9:55 PM, Theo Hultberg wrote: > no, there's no way. you should generate the TIMEUUID on the client side so > that you have it. > > T# > > > On Sat, Mar 29, 2014 at 1:01 AM, Andy Atj2 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 wsay 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 >> >> > --f46d044786ddb1f38004f5fed9a9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
You would get UUID object from cassandra API. Then you may= use uuid.timestamp() to get time stamp for the same

-Vivek


On Tue, Apr 1, 2014 at 9:55 PM, Theo Hultberg <theo@iconara.net> wrote:
no, there's no way. you should generate the TIMEUUID o= n the client side so that you have it.

T#=A0


On Sat, Mar 29, 2014 at 1:01 AM, Andy Atj2 <andyatj2@gmail.com&g= t; 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 gen= erate the value of the timeuuid.

After the INSERT, I need the Cassandra-generated timeuu= id value. Is there an easy wsay to get it, without having to re-query for t= he 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 gene= rated 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



--f46d044786ddb1f38004f5fed9a9--