Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
916 B
5
Indexable
Never
from cassandra.cqlengine.models import Model
from cassandra.cqlengine import columns
from cassandra.cqlengine import connection

class HosCartDetailsByStatus(Model):
    hoscd_status = columns.Text(primary_key=True, partition_key=True)
    hoscd_event_date = columns.Date(primary_key=True, clustering_order='DESC')
    hoscd_businessid = columns.Text(primary_key=True)
    hoscd_buid = columns.Text()
    hoscd_createdtime = columns.DateTime()
    hoscd_opid = columns.Text()
    hoscd_type = columns.Text()
    hoscd_updatedtime = columns.DateTime()
    hoscd_username = columns.Text()
    hoscd_value = columns.Blob()
    hoscd_valuetype = columns.Text()

    @classmethod
    def get_data(cls, status, limit):
        query = cls.objects.filter(hoscd_status=status).limit(limit)
        return list(query)

    class Meta:
        keyspace = 'your_keyspace_name'
        table_name = 'hos_cart_details_by_status'