コード例 #1
0
class Message(BaseModel):
    user_id = columns.Text(primary_key=True)
    message_id = columns.Integer(primary_key=True)  # counter.message_id
    thread_id = columns.Integer()  # counter.thread_id
    message_type = columns.Text()
    date_insert = columns.DateTime()
    security_level = columns.Integer()
    subject = columns.Text()  # Subject of email, the message for short
    external_message_id = columns.Text()
    external_parent_id = columns.Text()
    tags = columns.List(columns.Text)
    flags = columns.List(columns.Text)  # Seen, Recent, Deleted, ... IMAP?
コード例 #2
0
class Sample(Model):
    id = columns.Integer(primary_key=True)
    # id = columns.TimeUUID(primary_key=True)
    sale = columns.Text()
    sales_amount_in_euro = columns.Text()
    time_delay_for_conversion = columns.Text()
    click_timestamp = columns.Text()
    nb_clicks_1week = columns.Text()
    product_price = columns.Text()
    product_age_group = columns.Text()
    device_type = columns.Text()
    audience_id = columns.Text()
    product_gender = columns.Text()
    product_brand = columns.Text()
    product_category_1 = columns.Text()
    product_category_2 = columns.Text()
    product_category_3 = columns.Text()
    product_category_4 = columns.Text()
    product_category_5 = columns.Text()
    product_category_6 = columns.Text()
    product_category_7 = columns.Text()
    product_country = columns.Text()
    product_id = columns.Text()
    product_title = columns.Text()
    partner_id = columns.Text()
    user_id = columns.Text()
    predicted = columns.Text()
    probabilities = columns.List(columns.Float)
コード例 #3
0
 def test_instantiation_with_column_class(self):
     """
     Tests that columns instantiated with a column class work properly
     and that the class is instantiated in the constructor
     """
     column = columns.List(columns.Text)
     assert isinstance(column.value_col, columns.Text)
コード例 #4
0
class RRule(BaseModel):
    """Recurrence Rule"""
    user_id = columns.Text(primary_key=True)  # partition key
    rrule_id = columns.UUID(primary_key=True, default=uuid.uuid4)
    type = columns.Text()
    occurrence = columns.Integer(default=1)
    value = columns.Integer()
    events = columns.List(columns.UUID)
コード例 #5
0
 def test_to_python(self):
     """ Tests that to_python of value column is called """
     column = columns.List(JsonTestColumn)
     val = [1, 2, 3]
     db_val = column.to_database(val)
     assert db_val.value == [json.dumps(v) for v in val]
     py_val = column.to_python(db_val.value)
     assert py_val == val
コード例 #6
0
class FilterRule(BaseModel):
    user_id = columns.Text(primary_key=True)
    rule_id = columns.Integer(primary_key=True)  # counter.rule_id
    date_insert = columns.DateTime()
    name = columns.Text()
    filter_expr = columns.Text()
    position = columns.Integer()
    stop_condition = columns.Integer(default=None)
    tags = columns.List(columns.Text)
コード例 #7
0
class TestQueryUpdateModel(Model):

    partition = columns.UUID(primary_key=True, default=uuid4)
    cluster = columns.Integer(primary_key=True)
    count = columns.Integer(required=False)
    text = columns.Text(required=False, index=True)
    text_set = columns.Set(columns.Text, required=False)
    text_list = columns.List(columns.Text, required=False)
    text_map = columns.Map(columns.Text, columns.Text, required=False)
コード例 #8
0
class Contact(BaseModel):
    contact_id = columns.UUID(primary_key=True, default=uuid.uuid4)
    user_id = columns.Text(primary_key=True)
    first_name = columns.Text()
    last_name = columns.Text()
    date_insert = columns.DateTime()
    date_update = columns.DateTime()
    groups = columns.List(columns.Text)
    # Abstract everything else in a map
    infos = columns.Map(columns.Text, columns.Text)
コード例 #9
0
    def test_update_from_empty(self):
        """ Tests that updating an empty list creates a straight insert statement """
        ctx = {}
        col = columns.List(columns.Integer, db_field="TEST")
        statements = col.get_update_statement([1, 2, 3], [], ctx)

        #only one variable /statement should be generated
        assert len(ctx) == 1
        assert len(statements) == 1

        assert ctx.values()[0].value == [1, 2, 3]
        assert statements[0] == '"TEST" = {}'.format(ctx.keys()[0])
コード例 #10
0
    def test_partial_update_creation(self):
        """ Tests that proper update statements are created for a partial list update """
        final = range(10)
        initial = final[3:7]

        ctx = {}
        col = columns.List(columns.Integer, db_field="TEST")
        statements = col.get_update_statement(final, initial, ctx)

        assert len([v for v in ctx.values() if [2, 1, 0] == v.value]) == 1
        assert len([v for v in ctx.values() if [7, 8, 9] == v.value]) == 1
        assert len([s for s in statements if '"TEST" = "TEST" +' in s]) == 1
        assert len([s for s in statements if '+ "TEST"' in s]) == 1
コード例 #11
0
ファイル: models.py プロジェクト: yookore/activity_engine
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
コード例 #12
0
class UserProfile(Model):
    __table_name__ = "userprofile"
    username = columns.Text(primary_key=True)
    firstname = columns.Text(required=False)
    lastname = columns.Text(required=False)
    email = columns.Text(required=False)
    alternate_email = columns.Text(required=False)
    biography = columns.Text(required=False)
    birthdate = columns.DateTime(required=True)
    cellphone = columns.Text(required=False)
    currentcountry = columns.Text(required=False)
    gender = columns.Text(required=True)
    homecountry =columns.Text(required=False)
    imageurl = columns.Text(required=False)
    interests = columns.List(value_type=columns.Text)
    lastupdated = columns.DateTime(required=False)
    profilepicture = columns.Blob(required=False)
    relationshipstatus = columns.Text(required=False)
    religion = columns.Text(required=False)
    timezone = columns.Text(required=False)
    title = columns.Text(required=False)
コード例 #13
0
class ActorLastFirst(Model):
    idactor = columns.Integer(primary_key=True)
    firstname = columns.Text(primary_key=True, partition_key=True)
    lastname = columns.Text(primary_key=True, partition_key=True)
    gender = columns.Text()
    movies_id = columns.List(columns.Integer)
コード例 #14
0
 def test_instantiation_with_column_instance(self):
     """
     Tests that columns instantiated with a column instance work properly
     """
     column = columns.List(columns.Text(min_length=100))
     assert isinstance(column.value_col, columns.Text)
コード例 #15
0
class TestListModel(Model):

    partition = columns.UUID(primary_key=True, default=uuid4)
    int_list = columns.List(columns.Integer, required=False)
    text_list = columns.List(columns.Text, required=False)
コード例 #16
0
class userfollow(Model):
    username = columns.Text(primary_key=True)
    following = columns.List(columns.Text)

    def __repr__(self):
        return '%s %d' % (self.username, self.following)
コード例 #17
0
class tsunami_table(Model):
    code_gsm = columns.Text(primary_key=True)
    timeslot        = columns.Integer(primary_key=True)
    phone      = columns.List(columns.Integer)
コード例 #18
0
class RawMail(BaseModel):
    raw_id = columns.Text(primary_key=True)
    users = columns.List(columns.Text)
    data = columns.Bytes()
コード例 #19
0
ファイル: 2011_events.py プロジェクト: VinaySagar92/gitgraph
class userrepo2011(Model):
    username = columns.Text(primary_key=True)
    repo = columns.List(columns.Text)

    def __repr__(self):
        return '%s %d' % (self.username, self.repo)
コード例 #20
0
class testuserfollow(Model):
    username = columns.Text(primary_key=True)
    f = columns.List(columns.Text)

    def __repr__(self):
        return (self.username, self.follows)
コード例 #21
0
ファイル: hierachy.py プロジェクト: arunkgupta/pythonhackers
class GithubUserList(MBase):
    user = columns.Text(primary_key=True)
    starred = columns.List(value_type=columns.Text)
    following = columns.List(value_type=columns.Text)
    followers = columns.List(value_type=columns.Text)