cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Юрий Пухальский)
Subject AttributeError python exception when using Models
Date Sun, 06 Dec 2015 13:05:33 GMT
Good day, everyone!

I'm using 2.7.2 python driver from gentoo portage.
When I use traditional inserts and selects within my program, it works ok. But when I try
to use models, the program fails with an exception.

Here's the minimal program (I'm very new to cassandra, so maybe I'm missing something very


import logging

from cassandra.cqlengine import columns
from cassandra.cqlengine.models import Model
from import sync_table

from cassandra.cluster import Cluster

logging.basicConfig(format='%(asctime)s: %(message)s',
                    datefmt="%H:%M:%S", level=logging.WARNING)

cl_ips= [] # Removed for the post

cluster = Cluster(cl_ips)
session = cluster.connect('skipped')

class Tst(Model):

if False:

if True:
    tst=Tst.create(field='aaa', field1='bbb')

Whether I do sync or try to update the already existing table, it fails:

Traceback (most recent call last):
  File "./", line 33, in <module>
    tst=Tst.create(field='aaa', field1='bbb')
  File "/usr/lib64/python3.4/site-packages/cassandra/cqlengine/", line 612, in create
    return cls.objects.create(**kwargs)
  File "/usr/lib64/python3.4/site-packages/cassandra/cqlengine/", line 715, in create
  File "/usr/lib64/python3.4/site-packages/cassandra/cqlengine/", line 677, in save
  File "/usr/lib64/python3.4/site-packages/cassandra/cqlengine/", line 1028, in __init__
    self.column_family_name = self.model.column_family_name()
  File "/usr/lib64/python3.4/site-packages/cassandra/cqlengine/", line 512, in column_family_name
    return '{0}.{1}'.format(protect_name(cls._get_keyspace()), cf_name)
  File "cassandra/", line 1425, in cassandra.metadata.protect_name (cassandra/metadata.c:30775)
  File "cassandra/", line 1459, in cassandra.metadata.maybe_escape_name (cassandra/metadata.c:31554)
  File "cassandra/", line 1463, in cassandra.metadata.escape_name (cassandra/metadata.c:31634)
AttributeError: 'NoneType' object has no attribute 'replace'

I've tried to google for the similar problem, but couldn't find anything close.
Can you please direct me where to look for the roots of this problem?

View raw message