示例#1
0
class yiUser(clickhouseModel):
    user_id = fields.StringField()
    mobile = fields.StringField()
    status = fields.StringField()
    realname = fields.StringField()
    identity = fields.StringField()
    come_from = fields.StringField()
    down_from = fields.StringField()
    create_time = fields.StringField()
    birth_year = fields.StringField()
    last_login_time = fields.StringField()
    verify_time = fields.StringField()
    theday = fields.DateField()

    engines = engines.MergeTree('theday', ('user_id', 'theday'), 8192)

    # 表名
    @classmethod
    def table_name(cls):
        return 'yi_user_all'

    def count(self, user_id):
        return self.objects_in(self.riskModel).filter(user_id = user_id).count()

    def batchSave(self, insertList):
        try:
            self.riskModel.insert(insertList)
            return True
        except:
            return False
示例#2
0
class Actions(md.Model):
    # describes datatypes and fields
    user_id = fd.UInt64Field()
    user_name = fd.StringField()
    time = fd.StringField()
    event_type = fd.StringField()
    screen_name = fd.StringField()
    app_name = fd.StringField()
    app_productname = fd.StringField()
    app_version = fd.StringField()
    app_publisher = fd.StringField()
    app_file = fd.StringField()
    app_copyright = fd.StringField()
    app_language = fd.StringField()
    file_versioninfo = fd.StringField()
    file_description = fd.StringField()
    file_internalname = fd.StringField()
    file_originalname = fd.StringField()
    Date = fd.DateField(default=datetime.date.today())
    engine = en.MergeTree(
        'Date',
        ('user_id', 'user_name', 'time', 'event_type', 'screen_name',
         'app_name', 'app_productname', 'app_version', 'app_publisher',
         'app_file', 'app_copyright', 'app_language', 'file_versioninfo',
         'file_description', 'file_internalname', 'file_originalname'))
示例#3
0
class Adstat(md.Model):
    idSite = fd.UInt64Field()
    AdCampaignId = fd.StringField()
    AdBannerId = fd.StringField()
    AdDeviceType = fd.StringField()
    AdGroupId = fd.StringField()
    AdKeywordId = fd.StringField()
    AdPosition = fd.StringField()
    AdPositionType = fd.StringField()
    AdRegionId = fd.StringField()
    AdRetargetindId = fd.StringField()
    AdPlacement = fd.StringField()
    AdTargetId = fd.StringField()
    AdvertisingSystem = fd.StringField()
    DRF = fd.StringField()
    campaignContent = fd.StringField()
    campaignKeyword = fd.StringField()
    campaignMedium = fd.StringField()
    campaignName = fd.StringField()
    campaignSource = fd.StringField()
    StatDate = fd.DateField()
    StatDateTime = fd.DateTimeField()
    Impressions = fd.UInt64Field()
    Clicks = fd.UInt64Field()
    Cost = fd.Float64Field()
    IntegrationId = fd.StringField()
    Sign = fd.Int8Field()
    engine = en.CollapsingMergeTree(
        ('StatDate', 'IntegrationId'),
        ('StatDate', 'IntegrationId', 'idSite', 'AdCampaignId', 'AdBannerId',
         'AdDeviceType', 'AdGroupId', 'AdKeywordId', 'AdPosition',
         'AdPositionType', 'AdRegionId', 'AdRetargetindId', 'AdPlacement',
         'AdTargetId', 'AdvertisingSystem', 'DRF', 'campaignContent',
         'campaignKeyword', 'campaignMedium', 'campaignName', 'campaignSource',
         'StatDateTime'), 'Sign')
示例#4
0
class Person(models.Model):

    first_name = fields.StringField()
    last_name = fields.StringField()
    birthday = fields.DateField()
    height = fields.Float32Field()

    engine = engines.MergeTree('birthday',
                               ('first_name', 'last_name', 'birthday'))
class ClickHouseSecondTestModel(ClickHouseModel):
    django_model = SecondaryTestModel
    sync_delay = 2
    sync_enabled = True

    id = fields.Int32Field()
    created_date = fields.DateField()
    value = fields.Int32Field()

    engine = ReplacingMergeTree('created_date', ('id', ))
class ClickHouseTestModel(ClickHouseModel):
    django_model = TestModel
    sync_delay = 2
    sync_enabled = True

    id = fields.Int32Field()
    created_date = fields.DateField()
    value = fields.Int32Field()

    engine = ReplacingMergeTree('created_date', ('id', ))
    migrate_db_aliases = ('default', 'secondary')
class ClickHouseCollapseTestModel(ClickHouseModel):
    django_model = TestModel
    sync_delay = 2
    sync_enabled = True

    id = fields.Int32Field()
    created_date = fields.DateField()
    value = fields.Int32Field()
    sign = fields.Int8Field()

    engine = CollapsingMergeTree('created_date', ('id', ), 'sign')
示例#8
0
class yafIosLbs(clickhouseModel):
    creat_time = fields.StringField()
    mil_timestmp = fields.StringField()
    itime = fields.StringField()
    user_id = fields.StringField()
    uuid = fields.StringField()
    platform = fields.StringField()
    generation = fields.StringField()
    wifi = fields.StringField()
    ssid = fields.StringField()
    ip = fields.StringField()
    cell_id = fields.StringField()
    location_area_code = fields.StringField()
    mobile_country_code = fields.StringField()
    mobile_network_code = fields.StringField()
    radio_type = fields.StringField()
    type = fields.StringField()
    network_type = fields.StringField()
    coordinate_source = fields.StringField()
    coordinate = fields.StringField()
    network_speed = fields.StringField()
    wifi_lists = fields.StringField()
    bluetooth_lists = fields.StringField()
    mHasSpeed = fields.StringField()
    mSpeed = fields.StringField()
    mHasRadius = fields.StringField()
    mRadius = fields.StringField()
    netWorkLocationType = fields.StringField()
    locationID = fields.StringField()
    theday = fields.DateField()

    engines = engines.MergeTree('theday', ('user_id', 'theday'), 8192)

    # 表名
    @classmethod
    def table_name(cls):
        return 'yaf_yyy_ios_lbs_all'

    # 项目代号
    @classmethod
    def project_num(cls):
        return 2

    # 获取最大时间
    def getLastTime(self):
        lastTime = self.objects_in(self.yyyModel).filter(
            creat_time__between=['2000-01-01 00:00:00', '2100-12-31 23:59:59'
                                 ]).order_by('-creat_time').only('creat_time')
        if lastTime.count() == 0:
            return '2000-01-01 00:00:00'
        else:
            return lastTime[0].creat_time
示例#9
0
class ClickhouseAllFields(chm.Model):

    id = chf.Int64Field()
    timestamp = chf.DateTimeField()
    timestamp_date = chf.DateField()
    string_field = chf.StringField()
    intfield = chf.Int32Field()
    floatfield = chf.Float32Field()
    null_field = chf.NullableField(chf.StringField())
    enum_field = chf.Enum16Field(enum_)
    array_field = chf.ArrayField(chf.Int16Field())

    engine = MergeTree('timestamp_date', ['id'])
示例#10
0
class weixin(clickhouseModel):
    source = fields.StringField()
    request_time = fields.StringField()
    start_time = fields.StringField()
    sessionId = fields.StringField()
    ip = fields.StringField()
    g_uid = fields.StringField()
    is_login = fields.StringField()
    channelid = fields.StringField()
    activity = fields.StringField()
    user_agent = fields.StringField()
    from_url = fields.StringField()
    url = fields.StringField()
    cookieId = fields.StringField()
    logId = fields.StringField()
    _aid = fields.StringField()
    sign = fields.StringField()
    uuid = fields.StringField()
    nickname = fields.StringField()
    sex = fields.StringField()
    area = fields.StringField()
    event_name = fields.StringField()
    openId = fields.StringField()
    end_time = fields.StringField()
    taken_time = fields.StringField()
    theday = fields.DateField()

    engines = engines.MergeTree('theday', ('g_uid', 'theday'), 8192)

    # 表名
    @classmethod
    def table_name(cls):
        return 'youkayouqian_weixin_all'

    # 项目代号
    @classmethod
    def project_num(cls):
        return 4

    # 获取最大时间
    def getLastTime(self):
        lastTime = self.objects_in(
            self.ykyqModel).filter(request_time__between=[
                '2000-01-01 00:00:00', '2100-12-31 23:59:59'
            ]).order_by('-request_time').only('request_time')
        if lastTime.count() == 0:
            return '2000-01-01 00:00:00'
        else:
            return lastTime[0].request_time
示例#11
0
class yafIosGlobal(clickhouseModel):
    creat_time = fields.StringField()
    mil_timestmp = fields.StringField()
    g_eventname = fields.StringField()
    g_url = fields.StringField()
    g_sessionId = fields.StringField()
    g_uid = fields.StringField()
    g_ip = fields.StringField()
    g_build = fields.StringField()
    g_source = fields.StringField()
    g_channelid = fields.StringField()
    g_activity = fields.StringField()
    g_uuid = fields.StringField()
    _residence_time = fields.StringField()
    _source_page = fields.StringField()
    _share_friend = fields.StringField()
    _share_c_friend = fields.StringField()
    coupon_amount = fields.StringField()
    logId = fields.StringField()
    _location_status = fields.StringField()
    _notice_status = fields.StringField()
    request_result = fields.StringField()
    password_show = fields.StringField()
    payType = fields.StringField()
    theday = fields.DateField()

    engines = engines.MergeTree('theday', ('g_uid', 'theday'), 8192)

    # 表名
    @classmethod
    def table_name(cls):
        return 'yaf_zrkey_ios_global_all'

    # 项目代号
    @classmethod
    def project_num(cls):
        return 3

    # 获取最大时间
    def getLastTime(self):
        lastTime = self.objects_in(self.zrkeyModel).filter(
            creat_time__between=['2000-01-01 00:00:00', '2100-12-31 23:59:59'
                                 ]).order_by('-creat_time').only('creat_time')
        if lastTime.count() == 0:
            return '2000-01-01 00:00:00'
        else:
            return lastTime[0].creat_time
示例#12
0
class BearRequests_development(models.Model):

    EventDate = fields.DateField()
    RequestTime = fields.DateTimeField()
    RequestPath = fields.StringField()
    RequestCommand = fields.StringField()
    RequestVersion = fields.StringField()
    RequestRaw = fields.StringField()
    ProbeName = fields.StringField()
    RequestDetectionID = fields.Int32Field()
    BotIP = fields.StringField()
    BotCountry = fields.StringField()
    BotUA = fields.StringField()
    BotContinent = fields.StringField()
    BotTracert = fields.StringField()
    BotDNSName = fields.StringField()
    engine = engines.MergeTree('EventDate', ('RequestTime', 'BotIP'))
示例#13
0
class yafWeb(clickhouseModel):
    creat_time = fields.StringField()
    mil_timestmp = fields.StringField()
    _aid = fields.StringField()
    activity = fields.StringField()
    channelid = fields.StringField()
    cookieId = fields.StringField()
    from_url = fields.StringField()
    g_uid = fields.StringField()
    height = fields.StringField()
    ip = fields.StringField()
    Is_login = fields.StringField()
    logId = fields.StringField()
    request_time = fields.StringField()
    sreen_height = fields.StringField()
    screen_width = fields.StringField()
    sessionId = fields.StringField()
    source = fields.StringField()
    url = fields.StringField()
    user_agent = fields.StringField()
    uuid = fields.StringField()
    width = fields.StringField()
    theday = fields.DateField()

    engines = engines.MergeTree('theday', ('g_uid', 'theday'), 8192)

    # 表名
    @classmethod
    def table_name(cls):
        return 'yaf_zrkey_web_all'

    # 项目代号
    @classmethod
    def project_num(cls):
        return 3

    # 获取最大时间
    def getLastTime(self):
        lastTime = self.objects_in(self.zrkeyModel).filter(
            creat_time__between=['2000-01-01 00:00:00', '2100-12-31 23:59:59'
                                 ]).order_by('-creat_time').only('creat_time')
        if lastTime.count() == 0:
            return '2000-01-01 00:00:00'
        else:
            return lastTime[0].creat_time
示例#14
0
class Event(models.Model):
    t = fields.Enum8Field(EventType)
    tid = fields.StringField()
    cid = fields.NullableField(fields.UUIDField())
    cn = fields.StringField()
    cf1 = fields.NullableField(fields.StringField())
    cf2 = fields.NullableField(fields.StringField())
    cf3 = fields.NullableField(fields.StringField())
    cf4 = fields.NullableField(fields.StringField())
    cf5 = fields.NullableField(fields.StringField())

    dl = fields.NullableField(fields.StringField())
    dr = fields.NullableField(fields.StringField())
    uip = fields.NullableField(fields.StringField())
    utt = fields.NullableField(fields.StringField())
    ua = fields.NullableField(fields.StringField())

    # Event fields
    # (Required for event type)
    ec = fields.NullableField(fields.StringField())
    ea = fields.NullableField(fields.StringField())
    el = fields.NullableField(fields.StringField())
    ev = fields.NullableField(fields.Int64Field())

    # Transaction fields
    # (Required for transaction type)
    ti = fields.NullableField(fields.StringField())
    tr = fields.NullableField(fields.Decimal64Field(scale=6))

    # Revenue fields
    r = fields.NullableField(fields.Decimal64Field(scale=6))

    event_time = fields.DateTimeField()
    event_date = fields.DateField(materialized="toDate(event_time)")

    engine = engines.MergeTree("event_date", ("tid", "event_date"))

    @classmethod
    def table_name(cls):
        return "events"
示例#15
0
class yafIosStartup(clickhouseModel):
    creat_time = fields.StringField()
    mil_timestmp = fields.StringField()
    g_eventname = fields.StringField()
    g_url = fields.StringField()
    g_sessionId = fields.StringField()
    g_uid = fields.StringField()
    g_ip = fields.StringField()
    g_build = fields.StringField()
    g_source = fields.StringField()
    g_channelid = fields.StringField()
    g_activity = fields.StringField()
    g_uuid = fields.StringField()
    _residence_time = fields.StringField()
    _source_page = fields.StringField()
    _share_friend = fields.StringField()
    _share_c_friend = fields.StringField()
    coupon_amount = fields.StringField()
    logId = fields.StringField()
    _location_status = fields.StringField()
    _notice_status = fields.StringField()
    request_result = fields.StringField()
    password_show = fields.StringField()
    payType = fields.StringField()
    _models = fields.StringField()
    _screen = fields.StringField()
    _startup_time = fields.StringField()
    _resolution = fields.StringField()
    _systemversion = fields.StringField()
    _mem = fields.StringField()
    _storage = fields.StringField()
    _cpu = fields.StringField()
    _charge = fields.StringField()
    _rem_charge = fields.StringField()
    _bluetooth = fields.StringField()
    _bluetooth_status = fields.StringField()
    _language = fields.StringField()
    _operator = fields.StringField()
    _light = fields.StringField()
    _imei = fields.StringField()
    _mac = fields.StringField()
    _gps = fields.StringField()
    _net = fields.StringField()
    _wifi = fields.StringField()
    _bssid = fields.StringField()
    _gyro = fields.StringField()
    _gyro_info = fields.StringField()
    _app_version = fields.StringField()
    _is_login = fields.StringField()
    _last_start_time = fields.StringField()
    _last_end_time = fields.StringField()
    theday = fields.DateField()

    engines = engines.MergeTree('theday', ('g_uid', 'theday'), 8192)

    # 表名
    @classmethod
    def table_name(cls):
        return 'yaf_zrkey_ios_startup_all'

    # 项目代号
    @classmethod
    def project_num(cls):
        return 3

    # 获取最大时间
    def getLastTime(self):
        lastTime = self.objects_in(self.zrkeyModel).filter(
            creat_time__between=['2000-01-01 00:00:00', '2100-12-31 23:59:59'
                                 ]).order_by('-creat_time').only('creat_time')
        if lastTime.count() == 0:
            return '2000-01-01 00:00:00'
        else:
            return lastTime[0].creat_time
示例#16
0
class yafIosGlobal(clickhouseModel):
    creat_time = fields.StringField()
    mil_timestmp = fields.StringField()
    g_eventname = fields.StringField()
    g_url = fields.StringField()
    g_sessionId = fields.StringField()
    g_uid = fields.StringField()
    g_ip = fields.StringField()
    g_build = fields.StringField()
    g_source = fields.StringField()
    g_channelid = fields.StringField()
    g_activity = fields.StringField()
    g_uuid = fields.StringField()
    _residence_time = fields.StringField()
    _source_page = fields.StringField()
    _share_friend = fields.StringField()
    _share_c_friend = fields.StringField()
    coupon_amount = fields.StringField()
    logId = fields.StringField()
    _location_status = fields.StringField()
    _notice_status = fields.StringField()
    h5_url = fields.StringField()
    banner_url = fields.StringField()
    payType = fields.StringField()
    standard_id = fields.StringField()
    standard_type = fields.StringField()
    recharge_amount = fields.StringField()
    bankcard_num = fields.StringField()
    withdraw_amount = fields.StringField()
    theday = fields.DateField()

    engines= engines.MergeTree('theday', ('g_uid','theday'),8192)

    # 表名
    @classmethod
    def table_name(cls):
        return 'yaf_peanut_ios_global_all'

    # 项目代号
    @classmethod
    def project_num(cls):
        return 1

    # 客户端代号
    @classmethod
    def client_num(cls):
        return 2

    # 获取最大时间
    def getLastTime(self):
        lastTime = self.objects_in(self.peanutModel).filter(creat_time__between=['2000-01-01 00:00:00', '2100-12-31 23:59:59']).order_by('-creat_time').only('creat_time')
        if lastTime.count() == 0:
            return '2000-01-01 00:00:00'
        else:
            return lastTime[0].creat_time

    # 获取每小时的注册量
    def getRegisterNum(self,now,before):
        haveData = self.objects_in(self.peanutModel).filter(creat_time__gte=now).count()
        if haveData > 0:
            maxSize = self.objects_in(self.peanutModel).filter(creat_time__lte=now).only('g_uid').distinct().count()
            minSize = self.objects_in(self.peanutModel).filter(creat_time__lte=before).only('g_uid').distinct().count()
            size = maxSize - minSize
        else:
            size = -1
        return size

    # 获取页面的浏览量
    def getBrowseNum(self, now, before):
        haveData = self.objects_in(self.peanutModel).filter(creat_time__gte=now).count()
        if haveData <= 0:
            return []
        browseData = self.objects_in(self.peanutModel).filter(creat_time__between=[before, now], g_url__ne='empty').aggregate('g_url', sum='count()')
        if browseData.count() == 0:
            return [["Home", 0]]
        browseList = []
        for browse in browseData:
            browseList.append([browse.g_url, browse.sum])
        return browseList
示例#17
0
class yafWeb(clickhouseModel):
    creat_time = fields.StringField()
    mil_timestmp = fields.StringField()
    _aid = fields.StringField()
    activity = fields.StringField()
    channelid = fields.StringField()
    cookieId = fields.StringField()
    from_url = fields.StringField()
    g_uid = fields.StringField()
    height = fields.StringField()
    ip = fields.StringField()
    Is_login = fields.StringField()
    logId = fields.StringField()
    request_time = fields.StringField()
    sreen_height = fields.StringField()
    screen_width = fields.StringField()
    sessionId = fields.StringField()
    source = fields.StringField()
    url = fields.StringField()
    user_agent = fields.StringField()
    uuid = fields.StringField()
    width = fields.StringField()
    theday = fields.DateField()

    engines = engines.MergeTree('theday', ('g_uid', 'theday'), 8192)

    # 表名
    @classmethod
    def table_name(cls):
        return 'yaf_peanut_web_all'

    # 项目代号
    @classmethod
    def project_num(cls):
        return 1

    # 客户端代号
    @classmethod
    def client_num(cls):
        return 4

    # 获取最大时间
    def getLastTime(self):
        lastTime = self.objects_in(self.peanutModel).filter(
            creat_time__between=['2000-01-01 00:00:00', '2100-12-31 23:59:59'
                                 ]).order_by('-creat_time').only('creat_time')
        if lastTime.count() == 0:
            return '2000-01-01 00:00:00'
        else:
            return lastTime[0].creat_time

    # 获取每小时的注册量
    def getRegisterNum(self, now, before):
        haveData = self.objects_in(
            self.peanutModel).filter(creat_time__gte=now).count()
        if haveData > 0:
            maxSize = self.objects_in(self.peanutModel).filter(
                creat_time__lte=now).only('g_uid').distinct().count()
            minSize = self.objects_in(self.peanutModel).filter(
                creat_time__lte=before).only('g_uid').distinct().count()
            size = maxSize - minSize
        else:
            size = -1
        return size

    # 获取页面的浏览量
    def getBrowseNum(self, now, before):
        haveData = self.objects_in(
            self.peanutModel).filter(creat_time__gte=now).count()
        if haveData <= 0:
            return []
        browseData = self.objects_in(self.peanutModel).filter(
            creat_time__between=[before, now], url__ne='empty').only('url')
        if browseData.count() == 0:
            return [["https://www.yaoyuefu.com/", 0]]

        browseList = {}
        for browse in browseData:
            pattern = re.compile(
                r'\w*\:\/\/[\w*.]*[\w*\/]*\?type=\d*|\w*\:\/\/[\w*.]*[\w*\/]*\?id=|\w*\:\/\/[\w*.]*[\w*\/]*/?|\w*\:\/\/[\w*.]*[\w*\/]*'
            )
            result = pattern.findall(browse.url)
            if len(result) > 0:
                if result[0] in browseList:
                    browseList[result[0]] += 1
                else:
                    browseList[result[0]] = 1
        if len(browseList) == 0:
            return [["https://www.yaoyuefu.com/", 0]]

        urlList = []
        for url, num in browseList.items():
            urlList.append([url, num])
        return urlList
示例#18
0
class Hits_with_visits(md.Model):
# describes datatypes and fields
    idSite=fd.Int32Field()
    idVisit = fd.UInt64Field()
    visitIp=fd.StringField(default='none')
    visitorId=fd.StringField()
    goalConversions=fd.UInt64Field()
    siteCurrency=fd.StringField()
    siteCurrencySymbol=fd.StringField()
    serverDate=fd.DateField()
    visitServerHour=fd.UInt64Field()
    lastActionTimestamp=fd.UInt64Field()
    lastActionDateTime=fd.StringField()
    userId=fd.StringField()
    visitorType=fd.StringField()
    visitorTypeIcon=fd.StringField()
    visitConverted=fd.UInt64Field()
    visitConvertedIcon=fd.StringField()
    visitCount=fd.UInt64Field()
    firstActionTimestamp=fd.UInt64Field()
    visitEcommerceStatus=fd.StringField()
    visitEcommerceStatusIcon=fd.StringField()
    daysSinceFirstVisit=fd.UInt64Field()
    daysSinceLastEcommerceOrder=fd.UInt64Field()
    visitDuration=fd.UInt64Field()
    visitDurationPretty=fd.StringField()
    searches=fd.UInt64Field()
    actions=fd.UInt64Field()
    interactions=fd.UInt64Field()
    referrerType=fd.StringField()
    referrerTypeName=fd.StringField()
    referrerName=fd.StringField()
    referrerKeyword=fd.StringField()
    referrerKeywordPosition=fd.UInt64Field()
    referrerUrl=fd.StringField()
    referrerSearchEngineUrl=fd.StringField()
    referrerSearchEngineIcon=fd.StringField()
    languageCode=fd.StringField()
    language=fd.StringField()
    deviceType=fd.StringField()
    deviceTypeIcon=fd.StringField()
    deviceBrand=fd.StringField()
    deviceModel=fd.StringField()
    operatingSystem=fd.StringField()
    operatingSystemName=fd.StringField()
    operatingSystemIcon=fd.StringField()
    operatingSystemCode=fd.StringField()
    operatingSystemVersion=fd.StringField()
    browserFamily=fd.StringField()
    browserFamilyDescription=fd.StringField()
    browser=fd.StringField()
    browserName=fd.StringField()
    browserIcon=fd.StringField()
    browserCode=fd.StringField()
    browserVersion=fd.StringField()
    events=fd.UInt64Field()
    continent=fd.StringField()
    continentCode=fd.StringField()
    country=fd.StringField()
    countryCode=fd.StringField()
    countryFlag=fd.StringField()
    region=fd.StringField()
    regionCode=fd.StringField()
    city=fd.StringField()
    location=fd.StringField()
    latitude=fd.Float64Field()
    longitude=fd.Float64Field()
    visitLocalTime=fd.StringField()
    visitLocalHour=fd.UInt64Field()
    daysSinceLastVisit=fd.UInt64Field()
    customVariables=fd.StringField()
    resolution=fd.StringField()
    plugins=fd.StringField()
    pluginsIcons=fd.StringField()
    provider=fd.StringField()
    providerName=fd.StringField()
    providerUrl=fd.StringField()
    dimension1=fd.StringField()
    campaignId=fd.StringField()
    campaignContent=fd.StringField()
    campaignKeyword=fd.StringField()
    campaignMedium=fd.StringField()
    campaignName=fd.StringField()
    campaignSource=fd.StringField()
    serverTimestamp=fd.UInt64Field()
    serverTimePretty=fd.StringField()
    serverDatePretty=fd.StringField()
    serverDatePrettyFirstAction=fd.StringField()
    serverTimePrettyFirstAction=fd.StringField()
    totalEcommerceRevenue=fd.Float64Field()
    totalEcommerceConversions=fd.UInt64Field()
    totalEcommerceItems=fd.UInt64Field()
    totalAbandonedCartsRevenue=fd.Float64Field()
    totalAbandonedCarts=fd.UInt64Field()
    totalAbandonedCartsItems=fd.UInt64Field()
    AdCampaignId=fd.StringField()
    AdBannerId=fd.StringField()
    AdChannelId=fd.StringField()
    AdDeviceType=fd.StringField()
    AdGroupId=fd.StringField()
    AdKeywordId=fd.StringField()
    AdPosition=fd.StringField()
    AdPositionType=fd.StringField()
    AdRegionId=fd.StringField()
    AdRetargetindId=fd.StringField()
    AdPlacement=fd.StringField()
    AdTargetId=fd.StringField()
    AdvertisingSystem=fd.StringField()
    DRF=fd.StringField()
    Gclid=fd.StringField()
    SmartClickId=fd.StringField()
    Type=fd.StringField()
    goalName=fd.StringField(default='none')
    goalId=fd.UInt64Field()
    revenue=fd.UInt64Field()
    goalPageId=fd.StringField(default='none')
    url=fd.StringField(default='none')
    pageTitle=fd.StringField(default='none')
    pageIdAction=fd.UInt64Field(default=0)
    pageId=fd.UInt64Field(default=0)
    generationTimeMilliseconds=fd.UInt64Field(default=0)
    generationTime=fd.StringField()
    interactionPosition=fd.UInt64Field(default=0)
    icon=fd.StringField(default='none')
    timestamp=fd.UInt64Field(default=0)
    idpageview=fd.StringField(default='none')
    serverTimePrettyHit=fd.StringField()
    sign=fd.Int8Field()
# creating an sampled MergeTree
    engine = en.CollapsingMergeTree('serverDate', 
('idSite','idVisit','visitIp','visitorId','goalConversions','siteCurrency','siteCurrencySymbol','serverDate','visitServerHour', 
'lastActionTimestamp','lastActionDateTime','userId','visitorType','visitorTypeIcon','visitConverted','visitConvertedIcon', 
'visitCount','firstActionTimestamp','visitEcommerceStatus','visitEcommerceStatusIcon','daysSinceFirstVisit','daysSinceLastEcommerceOrder', 
'visitDuration','visitDurationPretty','searches','actions','interactions','referrerType','referrerTypeName','referrerName','referrerKeyword', 
'referrerKeywordPosition','referrerUrl','referrerSearchEngineUrl','referrerSearchEngineIcon','languageCode','language','deviceType','deviceTypeIcon','deviceBrand','deviceModel', 
'operatingSystem','operatingSystemName','operatingSystemIcon','operatingSystemCode','operatingSystemVersion','browserFamily','browserFamilyDescription', 
'browser','browserName','browserIcon','browserCode','browserVersion','events','continent','continentCode', 
'country','countryCode','countryFlag','region','regionCode','city','location','latitude','longitude','visitLocalTime','visitLocalHour', 
'daysSinceLastVisit','customVariables','resolution','plugins','pluginsIcons','provider','providerName','providerUrl','dimension1','campaignId', 
'campaignContent','campaignKeyword','campaignMedium','campaignName','campaignSource','serverTimestamp','serverTimePretty','serverDatePretty', 
'serverDatePrettyFirstAction','serverTimePrettyFirstAction','totalEcommerceRevenue','totalEcommerceConversions','totalEcommerceItems','totalAbandonedCartsRevenue', 
'totalAbandonedCarts','totalAbandonedCartsItems','AdCampaignId','AdBannerId','AdChannelId','AdDeviceType','AdGroupId','AdKeywordId','AdPosition','AdPositionType', 
'AdRegionId','AdRetargetindId','AdPlacement','AdTargetId','AdvertisingSystem','DRF','Gclid','SmartClickId','Type','goalName','goalId','revenue','goalPageId','url','pageTitle','pageIdAction', 
'pageId','generationTimeMilliseconds','generationTime','interactionPosition','icon','timestamp','idpageview','serverTimePrettyHit'),'sign')