Добавляет новые поля для clickHouse и парсинг параметров#1
Добавляет новые поля для clickHouse и парсинг параметров#1vusoltsev wants to merge 1 commit intoolegfedoseev:masterfrom
Conversation
| if source == 'hits': | ||
| if ('ym:pv:date' in fields) and ('ym:pv:clientID' in fields): | ||
| engine = 'MergeTree(Date, intHash32(ClientID), (Date, intHash32(ClientID)), 8192)' | ||
| engine = 'MergeTree(date, intHash32(clientID), (date, intHash32(clientID)), 8192)' |
There was a problem hiding this comment.
Почему названия полей стали с маленькой буквы? Вроде в кликхаусе принято с большой
There was a problem hiding this comment.
Максим попросил сделать с маленькой, ему так проще сказал
| else: | ||
| del splitted_text_filtered[i] | ||
| i -= 1 | ||
| i += 1 |
There was a problem hiding this comment.
Можно площе и проще:
i = 1
while i < len(splitted_text_filtered):
value = splitted_text_filtered[i].split('\t')
if len(value[params_index]) == 0:
del splitted_text_filtered[i]
continue
for field in ch_fields:
params_json = clear_json(value[params_index])
url = clear_json(value[url_index])
if !is_json(params_json):
splitted_text_filtered[i] += "\t"
continue
params = json.loads(params_json)
splitted_text_filtered[i] += "\t"
if len(params) > 0:
if type(params) is list:
params = params[0]
data = parsing_params.get_data_from_params(prefix, params, field, url)
splitted_text_filtered[i] += unicode(data)
i += 1
parsing_params.py
Outdated
|
|
||
| action = params.keys()[0] | ||
|
|
||
| if field == prefix+'hitType': |
There was a problem hiding this comment.
На сколько я помню в питоне по pep8 операторы обособляются пробелами.
Тут и везде.
parsing_params.py
Outdated
| return 'true' if offer_services.has_key('autoraiseX8') else 'false' | ||
|
|
||
| if field == prefix+'top': | ||
| return 'true' if offer_services.has_key('top') else 'false' |
There was a problem hiding this comment.
А зачем это всё? Зачем хардкодить имена сервисов? Мы разве не можем просто сохранить offer_services и уже в кликхаусе делать по ним выборки?
There was a problem hiding this comment.
Сначала сделал в offer_services, но требованию Максима пришлось для каждой услуги свое поле в таблице делать, говорит ему так удобнее будет
No description provided.