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 2AC59DAAF for ; Mon, 27 May 2013 14:29:45 +0000 (UTC) Received: (qmail 9829 invoked by uid 500); 27 May 2013 14:29:42 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 9723 invoked by uid 500); 27 May 2013 14:29:39 -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 9709 invoked by uid 99); 27 May 2013 14:29:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 May 2013 14:29:38 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of matthew.hillsborough@gmail.com designates 209.85.192.177 as permitted sender) Received: from [209.85.192.177] (HELO mail-pd0-f177.google.com) (209.85.192.177) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 May 2013 14:29:31 +0000 Received: by mail-pd0-f177.google.com with SMTP id u11so6668812pdi.36 for ; Mon, 27 May 2013 07:29:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=bN0Q/c+LjD/rQ1jCFM3NUjHGBM0mmwmZu+yXKv56CM8=; b=qzbUcySKt0bf6a476uGL1NtZ56QDB6joDG6//WxhUwVaqix1ATGdmXta3HbPw2rNTJ CRtMhe/b7W0WzNenaS1IQIZpYOWK6a485kEEi8caMSwEV8Zs/PSgm2fHAU4sGHiDsV9t q4FUpHQCuzDV8B5cV5n63qbEUxkrQtlApsuYzP22WFRyDs13TQQuqxqEv7XUluRcKAYv AilPvpLDMScRJluhmAym+OzOEPJb1t0lgBC7OrRFlCOZQFTZIkaVB4c0JHeITVYKPZ5P /KtQzBDdMVMYV7nBuWGzt1XL6pwn0LzES+G0snuwNp1313OXj4R8mk7tSs3jxI07jg2Q hPfg== X-Received: by 10.66.157.5 with SMTP id wi5mr30759648pab.33.1369664950406; Mon, 27 May 2013 07:29:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.66.12.4 with HTTP; Mon, 27 May 2013 07:28:50 -0700 (PDT) From: Matthew Hillsborough Date: Mon, 27 May 2013 10:28:50 -0400 Message-ID: Subject: Using CQL to insert a column to a row dynamically To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=047d7bacc834d4974f04ddb3f8a7 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bacc834d4974f04ddb3f8a7 Content-Type: text/plain; charset=ISO-8859-1 Hi all, I posted a similar thread on stackoverflow - hope it's not repetitive for anyone here. Looking for better insight from the community on whether Cassandra is the right tool for me or not. I am trying to understand some fundamentals in Cassandra, I was under the impression that one of the advantages a developer can take in designing a data model is by dynamically adding columns to a row identified by a key. That means I can model my data so that if it makes sense, a key can be something such as a user_id from a relational database, and I can for example, create arbitrary amounts of columns that relate to that user. What I'm not understanding is why there is so much emphasis to predefined columns in CQL examples, particularly in the CREATE TABLE/COLUMNFAMILY examples: CREATE TABLE emp ( empID int, deptID int, first_name varchar, last_name varchar, PRIMARY KEY (empID, deptID) ); Wouldn't this type of model make more sense to just stuff into a relational database? What if I don't know my column name until runtime and need to dynamically create it? Do I have to use ALTER TABLE to add a new column to the row using CQL? The particular app use-case I have in mind I would just need a key identifier and arbitrary column names where the column name might include a timestamp+variable_identifier. The whole point is that so I can see have extremely wide rows at the wonderful performance that Cassandra has to offer. As of right now, from everything I'm reading in regards to DataStax recommending CQL over Thrift (I think what I'm describing is possible with Thrift, but correct me if I'm wrong). That means I'd have to go AGAINST the recommendation to a protocol that's pretty much going to eventually not be supported. Is Cassandra the right tool for that? Are the predefined columns in documentation nothing more than an example? How does one add a dynamic column name with an existing column family/table? If I'm stuck with static columns, how is this any different than using a relational database such as postgres or mysql? What I found really powerful about Cassandra is being able to do something like the following in cassandra-cli which uses Thrift: SET mycf[id]['arbitrary_column'] = 'foo'; However, doing that in CQL isn't possible. Completely limits the way I was going to model my data for an application and would have no distinct advantage over a relational database. Please tell me I'm an idiot and/or am wrong and how I can make this work. It seems Thrift is the only solution, but I hate going against the recommended protocol. Thanks. --047d7bacc834d4974f04ddb3f8a7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi all,

I posted a similar thread= on stackoverflow - hope it's not repetitive for anyone here. Looking f= or better insight from the community on whether Cassandra is the right tool= for me or not.

I am trying to understand some fundamentals in Cassandra, I w= as under the impression that one of the advantages a developer can take in = designing a data model is by dynamically adding columns to a row identified= by a key. That means I can model my data so that if it makes sense, a key = can be something such as a user_id from a relational database, and I can fo= r example, create arbitrary amounts of columns that relate to that user.

What I'm not understanding is why there is so much emphas= is to predefined columns in CQL examples, particularly in the CREATE TABLE/= COLUMNFAMILY examples:

CREATE TABLE emp (

=A0 empID int,

=A0 deptID int,

=A0 first_name varchar,

=A0 last_name varchar,

=A0 PRIMARY KEY (empID, deptID)

);

Wouldn't this type of model make more sense to just stuff= into a relational database? What if I don't know my column name until = runtime and need to dynamically create it? Do I have to use ALTER TABLE to = add a new column to the row using CQL? The particular app use-case I have i= n mind I would just need a key identifier and arbitrary column names where = the column name might include a timestamp+variable_identifier. The whole po= int is that so I can see have extremely wide rows at the wonderful performa= nce that Cassandra has to offer. As of right now, from everything I'm r= eading in regards to DataStax recommending CQL over Thrift (I think what I&= #39;m describing is possible with Thrift, but correct me if I'm wrong).= That means I'd have to go AGAINST the recommendation to a protocol tha= t's pretty much going to eventually not be supported.

Is Cassandra the right tool for that? Are the predefined colu= mns in documentation nothing more than an example? How does one add a dynam= ic column name with an existing column family/table? If I'm stuck with = static columns, how is this any different than using a relational database = such as postgres or mysql? What I found really powerful about Cassandra is = being able to do something like the following in cassandra-cli which uses T= hrift:


SET mycf[id]['arbitrary_colum= n'] =3D 'foo';

However, doing that in CQ= L isn't possible. Completely limits the way I was going to model my dat= a for an application and would have no distinct advantage over a relational= database.


Please tell me I'm an i= diot and/or am wrong and how I can make this work. It seems Thrift is the o= nly solution, but I hate going against the recommended protocol.


Thanks.

--047d7bacc834d4974f04ddb3f8a7--