You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Kevin Castiglione <ke...@gmail.com> on 2009/07/07 15:01:21 UTC

problems with python client

i have inserted a row into the table Table1 and Standard1 column family. And
this works with the cassandra-cli

cassandra> get Table1.Standard1['1']
COLUMN_TIMESTAMP = 1246942866; COLUMN_VALUE = 24; COLUMN_KEY = age;
COLUMN_TIMESTAMP = 1246943353; COLUMN_VALUE = Chris Goffinet; COLUMN_KEY =
name;
Statement processed.


but if i try to get this data using the python client I get an empty list:
>>> client.get_slice(tablename='Table1', key='1', columnParent='Standard1',
start='0', finish='100', isAscending=True, offset=-1, count=1000)
[ ]

this is the output from cassandra
DEBUG - weakreadlocal reading SliceFromReadCommand(table='Table1', key='1',
columnFamily='Standard1', isAscending='true', limit='-1', count='1000')
DEBUG - clearing


also notice that the argument 'offset' in the python client is actually
passed to cassandra as 'limit'.


is there something im missing here?
thanks

Re: problems with python client

Posted by Matt Revelle <mr...@gmail.com>.
The "start" and "finish" columns specify the range of columns to be  
retrieved.

For example, start="age" and finish="height" would get you the age  
column but would not include the name column.  I would assume  
"isAscending" is the order of the returned columns.

On Jul 7, 2009, at 9:19 AM, Kevin Castiglione wrote:

> thanks a lot for this! it works.
> can you pl. explain what start, finish, isAscending are?
>
>
> also the value i pass to offset gets passed to cassandra as limit,  
> is this expected?
>
>
> >>> client.get_slice(tablename='Table1', key='1',  
> columnParent='Standard1', start='', finish='', isAscending=True,  
> offset=-1, count=1000)
> [column_t(columnName='age', value='24', timestamp=1246942866),  
> column_t(columnName='name', value='Chris Goffinet',  
> timestamp=1246943353)]
>
> DEBUG - weakreadlocal reading SliceFromReadCommand(table='Table1',  
> key='1', columnFamily='Standard1', isAscending='true', limit='-1',  
> count='1000')
>
>
>
> On Tue, Jul 7, 2009 at 6:12 AM, Jonathan Ellis <jb...@gmail.com>  
> wrote:
> you want
>
> start=''
> finish=''
> offset=0
>
> On Tue, Jul 7, 2009 at 8:01 AM, Kevin
> Castiglione<ke...@gmail.com> wrote:
> > i have inserted a row into the table Table1 and Standard1 column  
> family. And
> > this works with the cassandra-cli
> >
> > cassandra> get Table1.Standard1['1']
> > COLUMN_TIMESTAMP = 1246942866; COLUMN_VALUE = 24; COLUMN_KEY = age;
> > COLUMN_TIMESTAMP = 1246943353; COLUMN_VALUE = Chris Goffinet;  
> COLUMN_KEY =
> > name;
> > Statement processed.
> >
> >
> > but if i try to get this data using the python client I get an  
> empty list:
> >>>> client.get_slice(tablename='Table1', key='1',  
> columnParent='Standard1',
> >>>> start='0', finish='100', isAscending=True, offset=-1, count=1000)
> > [ ]
> >
> > this is the output from cassandra
> > DEBUG - weakreadlocal reading SliceFromReadCommand(table='Table1',  
> key='1',
> > columnFamily='Standard1', isAscending='true', limit='-1',  
> count='1000')
> > DEBUG - clearing
> >
> >
> > also notice that the argument 'offset' in the python client is  
> actually
> > passed to cassandra as 'limit'.
> >
> >
> > is there something im missing here?
> > thanks
> >
>


Re: problems with python client

Posted by Jonathan Ellis <jb...@gmail.com>.
On Tue, Jul 7, 2009 at 8:31 AM, Kevin
Castiglione<ke...@gmail.com> wrote:
> you can see that i passed the value -1 to offset and in the cassandra server
> log, it is received as the argument limit.
> offset and limit mean different things right? is this a problem in python
> client? or am i missing something here?

ah, that just means I forgot to update toString on the java side. :)

Re: problems with python client

Posted by Kevin Castiglione <ke...@gmail.com>.
On Tue, Jul 7, 2009 at 6:26 AM, Jonathan Ellis <jb...@gmail.com> wrote:

>  > also the value i pass to offset gets passed to cassandra as limit, is
> this
> > expected?
>
>
> not sure what you mean.
>

for the function get_slice, there is an argument *offset*. what does that
do? whatever value i pass to it, the cassandra server receives it as the
argument *limit*?
this is the python code:
>>> client.get_slice(tablename='Table1', key='1', columnParent='Standard1',
start='', finish='', isAscending=True, *offset=-1*, count=1000)

this is the debug log from cassandra.
DEBUG - weakreadlocal reading SliceFromReadCommand(table='Table1', key='1',
columnFamily='Standard1', isAscending='true', *limit='-1'*, count='1000')

you can see that i passed the value -1 to offset and in the cassandra server
log, it is received as the argument limit.
offset and limit mean different things right? is this a problem in python
client? or am i missing something here?
thanks

Re: problems with python client

Posted by Jonathan Ellis <jb...@gmail.com>.
On Tue, Jul 7, 2009 at 8:19 AM, Kevin
Castiglione<ke...@gmail.com> wrote:
> thanks a lot for this! it works.
> can you pl. explain what start, finish, isAscending are?

start = column name to start with
finish = " " to stop with
ascending = order to return columns in

> also the value i pass to offset gets passed to cassandra as limit, is this
> expected?

not sure what you mean.

Re: problems with python client

Posted by Kevin Castiglione <ke...@gmail.com>.
thanks a lot for this! it works.
can you pl. explain what start, finish, isAscending are?


also the value i pass to offset gets passed to cassandra as limit, is this
expected?


>>> client.get_slice(tablename='Table1', key='1', columnParent='Standard1',
start='', finish='', isAscending=True, offset=-1, count=1000)
[column_t(columnName='age', value='24', timestamp=1246942866),
column_t(columnName='name', value='Chris Goffinet', timestamp=1246943353)]

DEBUG - weakreadlocal reading SliceFromReadCommand(table='Table1', key='1',
columnFamily='Standard1', isAscending='true', limit='-1', count='1000')



On Tue, Jul 7, 2009 at 6:12 AM, Jonathan Ellis <jb...@gmail.com> wrote:

> you want
>
> start=''
> finish=''
> offset=0
>
> On Tue, Jul 7, 2009 at 8:01 AM, Kevin
> Castiglione<ke...@gmail.com> wrote:
> > i have inserted a row into the table Table1 and Standard1 column family.
> And
> > this works with the cassandra-cli
> >
> > cassandra> get Table1.Standard1['1']
> > COLUMN_TIMESTAMP = 1246942866; COLUMN_VALUE = 24; COLUMN_KEY = age;
> > COLUMN_TIMESTAMP = 1246943353; COLUMN_VALUE = Chris Goffinet; COLUMN_KEY
> =
> > name;
> > Statement processed.
> >
> >
> > but if i try to get this data using the python client I get an empty
> list:
> >>>> client.get_slice(tablename='Table1', key='1',
> columnParent='Standard1',
> >>>> start='0', finish='100', isAscending=True, offset=-1, count=1000)
> > [ ]
> >
> > this is the output from cassandra
> > DEBUG - weakreadlocal reading SliceFromReadCommand(table='Table1',
> key='1',
> > columnFamily='Standard1', isAscending='true', limit='-1', count='1000')
> > DEBUG - clearing
> >
> >
> > also notice that the argument 'offset' in the python client is actually
> > passed to cassandra as 'limit'.
> >
> >
> > is there something im missing here?
> > thanks
> >
>

Re: problems with python client

Posted by Jonathan Ellis <jb...@gmail.com>.
you want

start=''
finish=''
offset=0

On Tue, Jul 7, 2009 at 8:01 AM, Kevin
Castiglione<ke...@gmail.com> wrote:
> i have inserted a row into the table Table1 and Standard1 column family. And
> this works with the cassandra-cli
>
> cassandra> get Table1.Standard1['1']
> COLUMN_TIMESTAMP = 1246942866; COLUMN_VALUE = 24; COLUMN_KEY = age;
> COLUMN_TIMESTAMP = 1246943353; COLUMN_VALUE = Chris Goffinet; COLUMN_KEY =
> name;
> Statement processed.
>
>
> but if i try to get this data using the python client I get an empty list:
>>>> client.get_slice(tablename='Table1', key='1', columnParent='Standard1',
>>>> start='0', finish='100', isAscending=True, offset=-1, count=1000)
> [ ]
>
> this is the output from cassandra
> DEBUG - weakreadlocal reading SliceFromReadCommand(table='Table1', key='1',
> columnFamily='Standard1', isAscending='true', limit='-1', count='1000')
> DEBUG - clearing
>
>
> also notice that the argument 'offset' in the python client is actually
> passed to cassandra as 'limit'.
>
>
> is there something im missing here?
> thanks
>