paging through cql query on django

17 views
Skip to first unread message

Daniel Santos

unread,
Mar 6, 2018, 6:32:56 AM3/6/18
to DataStax Python Driver for Apache Cassandra User Mailing List
I have two queries. One that gives me the first page from a cassandra table, and another one that retrieves the successive pages. The fist one is like :

    select * from images_by_user where token(iduser) = token(5) limit 10 allow filtering;

The successive ones are :

    select * from images_by_user where token(iduser) = token(5) and imagekey > 90b18881-ccd3-4ed4-8cdf-d71eb99b3505 limit 10 allow filtering;

where the image key is the last one on the first page.

I have 13 rows in the table. The first query returns 10 both on the cqlsh and the application (consistency level ONE just for development).
The second query only retrieves results on clash. Below is the cassandra database engine configuration I have on the django application :

        'ENGINE': 'django_cassandra_engine',
        'NAME': 'xekmypic',
        'HOST': 'localhost',
        'OPTIONS': {
                'replication': {
                'strategy_class': 'SimpleStrategy',
                'replication_factor': 1
                },
                'connection': {
                        'consistency': ConsistencyLevel.LOCAL_ONE,
                        'retry_connect': True
                        # + All connection options for cassandra.cluster.Cluster()
        }
        }

The cassandra version I am using is doc-3.0.9 and below is my virtual env pip list :

    cassandra-driver (3.9.0)
    Cython (0.25)
    Django (1.11)
    django-cassandra-engine (1.1.0)
    mysqlclient (1.3.10)
    olefile (0.44)
    Pillow (4.1.0)
    pip (7.1.2)
    python-memcached (1.58)
    pytz (2017.2)
    setuptools (18.2)
    six (1.10.0)

Why does the second page does not return any results on the application but does on cqlsh prompt ?

Alan Boudreault

unread,
Mar 6, 2018, 9:30:47 AM3/6/18
to python-dr...@lists.datastax.com
Hello Daniel,

Unfortunately, I don´t know  django-cassandra-engine and this is not something we support. My guess is that it is just forwarding queries to cqlengine but I don´t know the internal stuff. Could you try to reproduce the issue using cqlengine only? Also, can you show me your table schema? You could also try to enable DEBUG logging and see what are the queries executed by cqlengine and how they differ from the those you tried in cqlsh:

import logging
log = logging.getLogger()
log.setLevel('DEBUG')
logging.basicConfig()

Regards,
Alan

--
You received this message because you are subscribed to the Google Groups "DataStax Python Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsubscribe@lists.datastax.com.



--

Alan Boudreault
Software Engineer (Drivers) | alan.bo...@datastax.com


Daniel Santos

unread,
Mar 6, 2018, 5:15:28 PM3/6/18
to python-dr...@lists.datastax.com
Hello,

I made a simple test just with the driver and its working properly. I am going to try to debug the django library to see what is happening.

Cheers

To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.

Reply all
Reply to author
Forward
0 new messages