Added extra check to filter out empty string client_id values.

Drop k/v pairs in the JSON blob where keys have empty values.
This commit is contained in:
Victor Ng 2018-02-02 00:37:42 -05:00
Родитель 4eac02a6ca
Коммит 4648c6cead
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -18,6 +18,7 @@ def filterDateAndClientID(row_jstr):
(row, jstr) = row_jstr
try:
assert row.client_id is not None
assert row.client_id != ""
dateutil.parser.parse(row.subsession_start_date)
return True
except Exception:
@ -48,6 +49,9 @@ def list_transformer(row_jsonstr):
jdata['client_id'] = client_id
jdata['start_date'] = start_date
# Filter out keys with an empty value
jdata = {key: value for key, value in jdata.items() if value}
# We need to return a 3-tuple of values
# (numrec_dynamodb_pushed, json_list_length, json_list)