Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Exclusive get count

Received: by 10.58.135.42 with SMTP id pp10mr1549145veb.18.1348768616320;
        Thu, 27 Sep 2012 10:56:56 -0700 (PDT)
X-BeenThere: pycassa-discuss@googlegroups.com
Received: by 10.52.89.80 with SMTP id bm16ls2641811vdb.9.gmail; Thu, 27 Sep
 2012 10:56:55 -0700 (PDT)
Received: by 10.59.10.42 with SMTP id dx10mr1572969ved.14.1348768615880;
        Thu, 27 Sep 2012 10:56:55 -0700 (PDT)
Received: by 10.59.10.42 with SMTP id dx10mr1572968ved.14.1348768615860;
        Thu, 27 Sep 2012 10:56:55 -0700 (PDT)
Return-Path: <ty...@datastax.com>
Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169])
        by gmr-mx.google.com with ESMTPS id r14si374423vdu.1.2012.09.27.10.56.55
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 27 Sep 2012 10:56:55 -0700 (PDT)
Received-SPF: pass (google.com: domain of ty...@datastax.com designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ty...@datastax.com designates 209.85.220.169 as permitted sender) smtp.mail=ty...@datastax.com
Received: by mail-vc0-f169.google.com with SMTP id fl17so2331367vcb.28
        for <pycassa-discuss@googlegroups.com>; Thu, 27 Sep 2012 10:56:55 -0700 (PDT)
        d=google.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type:x-gm-message-state;
        bh=y4INwGCcyoO8zeorjvVqm41VLDDgHyAaDoj9TpOq6y8=;
        b=X8JSoj4HiMFCqPxxnsVKgFeSBudBLbuxkMNvZPFodQRvMVLp0Sgf4wHcUiXFyMRcYh
         kclgOF/ku4mlEdSkMKj4N0Vfm+0Y3JOunO2lbg91Ch9oesKEMcfgHHbg8Xu+klIF1ohe
         J17BPZAetotfvfII5nxbSiSGzt/JfCPMtt7Vhqy7YUb91N6PvrAvNzm+jvKZbxPioYyN
         VQWXXKgAtz/0ARXB8vS6WIdWHlWEz1vX0wwAOShuZPfUYLcXlPfDiye+KcLKEqFerEbm
         UgLSyl40RngnBxv4WRhTIzD/HgpJ72tOGufKBhqJnvsr2Tz9pzC/0VRCjMAbPly7Ra7D
         B2Rw==
MIME-Version: 1.0
Received: by 10.58.32.234 with SMTP id m10mr2607948vei.60.1348768615711; Thu,
 27 Sep 2012 10:56:55 -0700 (PDT)
Received: by 10.58.135.38 with HTTP; Thu, 27 Sep 2012 10:56:55 -0700 (PDT)
In-Reply-To: <cb05c60e-b77b-4bb0-a4aa-38ba993446f6@googlegroups.com>
References: <88a9214d-a912-4a56-aa1e-cab17d0a437b@googlegroups.com>
	<CAAam9stsaAyU4oHNv09Qrmm+O9Bgg74FtLU23=ZmskuUVWp...@mail.gmail.com>
	<6ff5ba5a-ac45-47c8-9a96-8c459ed3865c@googlegroups.com>
	<CAAam9svvJVvNsqwcaTKMXDr_=uwPeytuiLdDL2=KsLbP1np...@mail.gmail.com>
	<4770263e-ef5d-4457-89e6-db38046ffb57@googlegroups.com>
	<CAAam9ssAVrHhaWVQrC_tUM46wfExHKBpnQy7B4Wo0gBuXBL...@mail.gmail.com>
	<016043ee-c550-4f66-b257-152c8b701ad1@googlegroups.com>
	<CAAam9svLc3+NG+S0NVCu3EM6pQKrH9Owr-ZoHYiiSnOn1Kr...@mail.gmail.com>
	<c458b856-3208-401a-b8e8-1ec20814ce46@googlegroups.com>
	<cb05c60e-b77b-4bb0-a4aa-38ba993446f6@googlegroups.com>
Date: Thu, 27 Sep 2012 12:56:55 -0500
Message-ID: <CAAam9sv5=Qd0zDwmeNzY07n=wfMx=hPpLJJbwOSd4yUfVzn...@mail.gmail.com>
Subject: Re: Exclusive get count
From: Tyler Hobbs <ty...@datastax.com>
To: pycassa-discuss@googlegroups.com
Content-Type: multipart/alternative; boundary=047d7b2ee4cb39442704cab2aab4
X-Gm-Message-State: ALoCoQnR3pXGM+XciOp9CkVu7QiK0Azczto129o5nC4O/ddbnErHiAOPRK0zwg4AjePXOtlOn9B3

--047d7b2ee4cb39442704cab2aab4
Content-Type: text/plain; charset=ISO-8859-1

I haven't had time to test this, but it looks like you have another problem
with single-element tuples.

Your version: result2 = cf.get('dummy_key', column_start=((key[0], False)))

The correct version:  result2 = cf.get('dummy_key', column_start=((key[0],
False),))

On Wed, Sep 26, 2012 at 10:53 PM, Cato Yeung <cato.ye...@gmail.com> wrote:

> I found that when I exclusively get datetype composite column, the result
> is not correct.
> I have made a simplified version of what I want to do here:
> import pycassa
> import datetime
>
> if __name__ == '__main__':
>     # initialize pool and column family
>     pool = pycassa.ConnectionPool('InviteAppRevamp2',
> server_list=['192.168.1.41:9160'], pool_size=1)
>     cf = pycassa.ColumnFamily(pool, 'test2')
>
>     # get current datetime
>     dt = datetime.datetime.now()
>     print 'current datetime: '+str(dt)
>
>     # insert into cassandra database
>     attr = {(dt,): "dummy_value"}
>     cf.insert('dummy_key', attr)
>
>     # get entry from cassandra database
>     result = cf.get('dummy_key')
>
>     # get entry from cassandra database, exclusively
>     key, value = result.popitem()
>     print 'datetime in cassandra: '+str(key[0])
>     result2 = cf.get('dummy_key', column_start=((key[0], False)))
>     print
> '----------------------------------------------------------------'
>     print 'I still can get the entry when I specify getting it
> exclusively:'
>     print result2
>
>     # get entry from cassandra database, inclusively
>     result3 = cf.get('dummy_key', column_start=((key[0], True)))
>     print
> '----------------------------------------------------------------'
>     print 'I still can get the entry when I specify getting it
> inclusively:'
>     print result3
>
>     # delete entry
>     cf.remove('dummy_key')
>
> or you can get by gist:
> https://gist.github.com/3792063
>
> What I want to do is that I can *get and get count exclusively.*
> Cheers,
> Cato
>



-- 
Tyler Hobbs
DataStax <http://datastax.com/>

--047d7b2ee4cb39442704cab2aab4
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I haven&#39;t had time to test this, but it looks like you have another pro=
blem with single-element tuples.<br><br>Your version: result2 =3D cf.get(&#=
39;dummy_key&#39;, column_start=3D((key[0], False)))<br><br>The correct ver=
sion:=A0 result2 =3D cf.get(&#39;dummy_key&#39;, column_start=3D((key[0], F=
alse),))<br>
<br><div class=3D"gmail_quote">On Wed, Sep 26, 2012 at 10:53 PM, Cato Yeung=
 <span dir=3D"ltr">&lt;<a href=3D"mailto:cato.ye...@gmail.com" target=3D"_b=
lank">cato.ye...@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gm=
ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le=
ft:1ex">
I found that when I exclusively get datetype composite column, the result i=
s not correct.<div>I have made a=A0simplified=A0version of what I want to d=
o here:</div><div><div>import pycassa</div><div>import datetime</div><div>=
=A0 =A0 =A0 =A0=A0</div>
<div>if __name__ =3D=3D &#39;__main__&#39;:</div><div>=A0 =A0 # initialize =
pool and column family</div><div>=A0 =A0 pool =3D pycassa.ConnectionPool(&#=
39;InviteAppRevamp2&#39;, server_list=3D[&#39;192.168.1.41:9160&#39;], pool=
_size=3D1)</div>
<div class=3D"im"><div>=A0 =A0 cf =3D pycassa.ColumnFamily(pool, &#39;test2=
&#39;)</div><div>=A0 =A0=A0</div></div><div>=A0 =A0 # get current datetime<=
/div><div>=A0 =A0 dt =3D datetime.datetime.now()</div><div>=A0 =A0 print &#=
39;current datetime: &#39;+str(dt)</div>
<div>=A0 =A0=A0</div><div>=A0 =A0 # insert into cassandra database</div><di=
v>=A0 =A0 attr =3D {(dt,): &quot;dummy_value&quot;}</div><div>=A0 =A0 cf.in=
sert(&#39;dummy_key&#39;, attr)</div><div>=A0 =A0=A0</div><div>=A0 =A0 # ge=
t entry from cassandra database</div>
<div>=A0 =A0 result =3D cf.get(&#39;dummy_key&#39;)</div><div>=A0 =A0=A0</d=
iv><div>=A0 =A0 # get entry from cassandra database, exclusively</div><div>=
=A0 =A0 key, value =3D result.popitem()</div><div>=A0 =A0 print &#39;dateti=
me in cassandra: &#39;+str(key[0])</div>
<div>=A0 =A0 result2 =3D cf.get(&#39;dummy_key&#39;, column_start=3D((key[0=
], False)))</div><div>=A0 =A0 print &#39;----------------------------------=
------------------------------&#39;</div><div>=A0 =A0 print &#39;I still ca=
n get the entry when I specify getting it exclusively:&#39;</div>
<div>=A0 =A0 print result2</div><div>=A0 =A0=A0</div><div>=A0 =A0 # get ent=
ry from cassandra database, inclusively</div><div>=A0 =A0 result3 =3D cf.ge=
t(&#39;dummy_key&#39;, column_start=3D((key[0], True)))</div><div>=A0 =A0 p=
rint &#39;----------------------------------------------------------------&=
#39;</div>
<div>=A0 =A0 print &#39;I still can get the entry when I specify getting it=
 inclusively:&#39;</div><div>=A0 =A0 print result3</div><div>=A0 =A0 =A0 =
=A0=A0</div><div>=A0 =A0 # delete entry</div><div>=A0 =A0 cf.remove(&#39;du=
mmy_key&#39;)</div></div>
<div><br></div><div>or you can get by gist:</div><div><a href=3D"https://gi=
st.github.com/3792063" target=3D"_blank">https://gist.github.com/3792063</a=
><br></div><div><br></div><div>What I want to do is that I can <b>get and g=
et count exclusively.</b></div>
<div>Cheers,</div><div>Cato</div></blockquote></div><br><br clear=3D"all"><=
br>-- <br><font color=3D"#888888">Tyler Hobbs<span></span><br>
<a href=3D"http://datastax.com/" target=3D"_blank">DataStax</a><br></font><=
br>

--047d7b2ee4cb39442704cab2aab4--