class AggregatedActivity(BaseActivity): activities = columns.Bytes(required=False) created_at = columns.DateTime(required=False) group = columns.Ascii(required=False) updated_at = columns.DateTime(required=False) seen_at = columns.DateTime(required=False) read_at = columns.DateTime(required=False)
class Activity(BaseActivity): actor = columns.Integer(required=False) extra_context = columns.Bytes(required=False) object = columns.Integer(required=False) target = columns.Integer(required=False) time = columns.DateTime(required=False) verb = columns.Integer(required=False)
class AggregatedActivity(Model): __table_name__ = "aggregated" feed_id = columns.Ascii(primary_key=True, partition_key=True) group = columns.Ascii(primary_key=True, partition_key=True) updated_at = columns.DateTime(primary_key=True, clustering_order='desc') activity_id = columns.TimeUUID(required=True) activities = columns.Bytes(required=False) created_at = columns.DateTime(required=False)
class Activity(Model): # partition key (1 row per user_id) feed_id = columns.Text(primary_key=True) # clustering key (used for sorting) activity_id = VarInt(primary_key=True) actor = columns.Integer(required=False) extra_context = columns.Bytes(required=False) object = columns.Integer(required=False) target = columns.Integer(required=False) time = columns.DateTime(required=False) verb = columns.Integer(required=False)
class Photo(Content): __polymorphic_key__ = 'photo' # objectid is the id of a container: photo album, blog post or status update object_id = columns.TimeUUID(required = True, index=True) caption = columns.Text(required = False) data = columns.Bytes(required = False) url_original = columns.Text(required = True) url_thumbnail = columns.Text(required=False) location = columns.Text(required=False) image_type = columns.Text(required=False) filename = columns.Text(required=False) width = columns.Integer(required=False) height = columns.Integer(required=False)
class Content(Model): __table_name__ = 'content' id = columns.TimeUUID(primary_key = True, default=uuid1) author = columns.Text(primary_key=True, clustering_order='ASC') content_type = columns.Text(polymorphic_key=True, index=True) #created_at = columns.DateTime(default=datetime.now(), primary_key = True, clustering_order='DESC') created_at = columns.DateTime(default=datetime.datetime.now()) updated_at = columns.DateTime() view_count = columns.Integer(default=0) like_count = columns.Integer(default=0) comment_count = columns.Integer(default=0) tags = columns.List(value_type=columns.Text(), default=[]) images = columns.List(value_type=columns.Bytes(), default=[]) #['url1','url2',...'urln'] img = columns.Bytes() def create(self): pass def commenting(self): pass def liking(self): pass
class RawMail(BaseModel): raw_id = columns.Text(primary_key=True) users = columns.List(columns.Text) data = columns.Bytes()
class AudioBlog(Content): __polymorphic_key__ = 'audioblog' caption = columns.Text(required = False) data = columns.Bytes(required = True) url_original = columns.Text()