backend
backend copied to clipboard
fix set_media_tag crashing bug
set_media_tag is crashing with this:
2018-08-27 02:21:18,451 MediaWords.DBI.Media.PrimaryLanguage: detect primary language for motisagron.wordpress.com [59652] ...
2018-08-27 02:21:18,460 MediaWords.DBI.Media.PrimaryLanguage: detect primary language for motisagron.wordpress.com [59652] update to he
Traceback (most recent call last):
File "/home/mediacloud/mediacloud/mediacloud/mediawords/db/result/result.py", line 77, in __execute
cursor.execute(*query_args)
File "/home/mediacloud/.virtualenvs/mediacloud/lib/python3.5/site-packages/psycopg2/extras.py", line 144, in execute
return super(DictCursor, self).execute(query, vars)
psycopg2.IntegrityError: null value in column "tags_id" violates not-null constraint
DETAIL: Failing row contains (1269184, 59652, null, 2018-08-27).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mediacloud/mediacloud/mediacloud/mediawords/db/handler.py", line 291, in query
print_warnings=self.__print_warnings)
File "/home/mediacloud/mediacloud/mediacloud/mediawords/db/result/result.py", line 35, in __init__
print_warnings=print_warnings)
File "/home/mediacloud/mediacloud/mediacloud/mediawords/db/result/result.py", line 114, in __execute
'mogrified_query': str(mogrified_query),
mediawords.db.exceptions.result.McDatabaseResultException: Query failed: null value in column "tags_id" violates not-null constraint
DETAIL: Failing row contains (1269184, 59652, null, 2018-08-27).
; query: ('insert into media_tags_map ( tags_id, media_id ) values ( %(param_1)s, %(param_2)s )\n', {'param_2': 59652, 'param_1': None}); mogrified query: b'insert into media_tags_map ( tags_id, media_id ) values ( NULL, 59652 )\n'