lrpri ya
lrpri ya

Reputation: 73

raise CQLEngineException("Models must be derived from base Model.") when running sync_table

I am very new to cassandra. Please help me figure out what is wrong in my code.

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

 class app_modules(Model):
    __table_name__ = 'app_modules'
    module_id = columns.UUID(primary_key=True)
    module_name = columns.Text()
    description = columns.Text()
    owner = columns.Text()
    created_timestamp = columns.TimeUUID()

This is my models. When i run a sync_table to create the table in my dev cassandra. I am facing an exception.

raise CQLEngineException("Models must be derived from base Model.")

Can you please help me figure out what is wrong in my models.

Thanks.

Upvotes: 2

Views: 221

Answers (1)

lrpri ya
lrpri ya

Reputation: 73

The issue got resolved. I was not using porper import for sync_table. I was using

from cqlengine.management import sync_table

I had to change this to

from cassandra.cqlengine.managenement import sync_table

It worked.

Upvotes: 1

Related Questions