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 426CAEDE8 for ; Tue, 25 Jun 2013 03:24:28 +0000 (UTC) Received: (qmail 21830 invoked by uid 500); 25 Jun 2013 03:24:25 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 21365 invoked by uid 500); 25 Jun 2013 03:24:24 -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 20857 invoked by uid 99); 25 Jun 2013 03:24:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jun 2013 03:24:23 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of blair@orcaware.com designates 108.0.197.17 as permitted sender) Received: from [108.0.197.17] (HELO orca4.orcaware.com) (108.0.197.17) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jun 2013 03:24:18 +0000 Received: from orca4.orcaware.com (localhost [127.0.0.1]) by orca4.orcaware.com (8.14.4/8.14.4/Debian-2.1ubuntu2) with ESMTP id r5P3NvC3014605; Mon, 24 Jun 2013 20:23:57 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orcaware.com; s=default; t=1372130637; bh=qw2zugBKEe2aiHdnTCmGkUESLWc28gvhMRtOY2QWPDk=; h=Date:From:To:Subject:From; b=GyJ/65busnCE4i6tUktF/Um8oBxAmTS1KPFL8H6ahVX48tjZY+SjpzudzE3uXD37J EJ/dvp0ceJEWdDaCotiQQ0gq3mwPdGVveE1xJu2dL8kZLsSl/HVgIyq4s9smxirEnF dpEDMGJqtlu1f0Lm4vEQ5onYoXajDpO/r5p/1LI8= Message-ID: <51C90D4D.8060300@orcaware.com> Date: Mon, 24 Jun 2013 20:23:57 -0700 From: Blair Zajac User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: "user@cassandra.apache.org" Subject: How to do a CAS UPDATE on single column CF? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org How does one do an atomic update in a column family with a single column? I have a this CF CREATE TABLE schema_migrations ( version TEXT PRIMARY KEY, ) WITH COMPACTION = {'class': 'LeveledCompactionStrategy'}; that records which database migrations have been applied. I want to do a CAS UPDATE to add a dummy lock token to prevent multiple migrations from running, but these three attempts fail (using the Python cql client): >>> cursor.execute("UPDATE schema_migrations SET version = 'locked' WHERE version = 'locked' IF NOT EXISTS") cql.apivalues.ProgrammingError: Bad Request: PRIMARY KEY part version found in SET part >>> cursor.execute("UPDATE schema_migrations SET WHERE version = 'locked' IF NOT EXISTS") cql.apivalues.ProgrammingError: Bad Request: line 1:29 no viable alternative at input 'WHERE' >>> cursor.execute("INSERT INTO schema_migrations (version) VALUES ('locked') IF NOT EXISTS") cql.apivalues.ProgrammingError: Bad Request: line 1:58 missing EOF at 'IF' Thanks, Blair