Thanks, I was actually thinking of doing that. Something along the lines of 

CREATE TABLE user (
  id    timeuuid PRIMARY KEY,
  email    text,
  name    text,
  ...
);

CREATE TABLE user_email_index (
  email  text,
  id  timeuuid,
  PRIMARY KEY (email, id)
);

And during registration, I would just use LWT on the user_email_index table 
first and insert the record and then insert the actual user record into user 
table w/o LWT. Does that sound right to you?

- Drew



On Jan 21, 2014, at 10:01 AM, Tupshin Harper <tups...@tupshin.com> wrote:

> One CQL row per user, keyed off of the UUID. 
> 
> Another table keyed off of email, with another column containing the UUID for 
> lookups in the first table.  Only registration will require a lightweight 
> transaction, and only for the purpose of avoiding duplicate email 
> registration race conditions.
> 
> -Tupshin
> 
> On Jan 21, 2014 9:17 AM, "Drew Kutcharian" <d...@venarc.com> wrote:
> A shameful bump ;)
> 
> > On Jan 20, 2014, at 2:14 PM, Drew Kutcharian <d...@venarc.com> wrote:
> >
> > Hey Guys,
> >
> > I’m new to CQL (but have been using C* for a while now). What would be the 
> > best way to model a users table using CQL/Cassandra 2.0 Lightweight 
> > Transactions where we would like to have:
> > - A unique TimeUUID as the primary key of the user
> > - A unique email address used for logging in
> >
> > In the past I would use Zookeeper and/or Astyanax’s "Uniqueness Constraint” 
> > but I want to see how can this be handled natively.
> >
> > Cheers,
> >
> > Drew
> >

Reply via email to