Search code examples
djangodjango-modelsmodelcassandracql3

Define a counter type column in django models using cql engine


I have a model with counter type column as below:

from cqlengine import columns
from cqlengine.models import Model

class CountView(Model):
    entryLink=columns.Text(primary_key=True)
    visited=columns.Counter()

But when i want create table from this model as below:

>>> from cqlengine import connection
>>> from cqlengine.management import create_table
>>> from MainAPP.models import CountView

I receive this error:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "H:/Web-Programming/Python/Project/Prexter\MainAPP\models.py", line 66, in <module>
class CountView(Model):
  File "H:/Web-Programming/Python/Project/Prexter\MainAPP\models.py", line 68, in CountView
visited=columns.Counter()
  File "H:\Web-Programming\Python\Project\Prexter\Virtual-Environment\Lib\site-packages\cqlengine\columns.py", line 421, in __init__
raise NotImplementedError
NotImplementedError

What is my wrong? How i must define a counter type column in my model? Please guide me...


Solution

  • Sorry you're having trouble. We haven't implemented counter columns in cqlengine yet, but are planning on adding by the 0.6 release.

    Thanks,

    Blake