On Sat, Jun 19, 2010 at 9:30 AM, Christian van der Leeden
<christian.vanderlee...@googlemail.com> wrote:
> Hi Thomas,
>
>        did you look at cassandra gem from twitter (fauna/cassandra) on github?
> They also use the thrift_client and already have the basic cassandra API 
> accessible.
>
> I'm also using ruby with cassandra and still need to find a slick way to do 
> the inserts
> and when to update the indexes.

Have you looked at CassandraObject for that?
http://github.com/nzkoz/cassandra_object

-ryan

>
> If I understood correctly you want to look up a user by name. And you want to 
> have
> the name as row keys where you would find the UID with which you could look 
> up your user?
>
> From my understanding I would put the index into one row, name it e.g. 
> "user_by_name",
> and insert columns where the column name is the user name and the value of 
> the column
> would be the UUID of the user. Cassandra creates the index on the column 
> names. You can
> efficiently insert new values into this row.
>
> What do you want to do with the users partitioned by date? Sorted by creation 
> date? Login date?
>
> For the cascading deletes: a database would have to remove a record from its 
> index, too.
> In Cassandra you would have to do it yourself..
>
> Christian
>
> On Jun 19, 2010, at 3:27 AM, Thomas Heller wrote:
>
>> Howdy!
>>
>> So, last week I finally got around to playing with Cassandra. After a
>> while I understood the basics. To test this assumption I started
>> working on my own Client implementation since "Learning-by-doing" is
>> what I do and existing Ruby Clients (which are awesome) already
>> abstracted too much for me to really grasp what was going on. Java is
>> not really my thing (anymore) so I began with the Thrift API and Ruby.
>>
>> Anyways back to Topic.
>>
>> This library is now is available at:
>> http://github.com/thheller/greek_architect
>>
>> Since I have virtually no experience with Cassandra (but plenty with
>> SQL) I started with the first use-case which I have programmed a bunch
>> of times before. User Management. I build websites which are used by
>> other people, so I need to store them somewhere.
>>
>> Step #1: Creating Users and persisting them in Cassandra
>>
>> Example here:
>> http://github.com/thheller/greek_architect/blob/master/spec/examples/user_create_spec.rb
>>
>> I hope my rspec-style documentation doesnt confuse too many people
>> since I already have a gazillion questions for this simple, but also
>> VERY common use-case. Since a question is best asked with a concrete
>> example to refer to, here goes my first one:
>>
>> Would any of you veterans build what I built the way I did? (refering
>> to the cassandra design, not the ruby client)
>>
>> I insert Users with UUID keys into one ColumnFamily. I then index them
>> by creating a row in another ColumnFamily using the Name as Key and
>> then adding one column holding a reference to the User UUID. I also
>> insert a reference into another ColumnFamily holding a List of Users
>> partitioned by Date.
>>
>> I'm really unsure about the index design, since they dont get updated
>> when a User row is removed. I could hook into the remove call (like I
>> did into mutations) and cascade the deletes where needed, but 10+
>> years of SQL always want to tell me I'm crazy for doing this stuff!
>>
>> I'd really appreciate some feedback.
>>
>> Cheers,
>> Thomas
>
>

Reply via email to