Commit 7e6dfa93 by Clinton Blackburn Committed by Clinton Blackburn

Handling MySQL warnings as exceptions

Truncation warnings should always be treated as exceptions to avoid future issues.

ECOM-4528
parent eb64601c
import platform import platform
import sys import sys
import warnings
from logging.handlers import SysLogHandler from logging.handlers import SysLogHandler
from os import environ from os import environ
import certifi import certifi
import MySQLdb
import yaml import yaml
from course_discovery.settings.base import * from course_discovery.settings.base import *
...@@ -72,3 +74,7 @@ HAYSTACK_CONNECTIONS['default'].update({ ...@@ -72,3 +74,7 @@ HAYSTACK_CONNECTIONS['default'].update({
for override, value in DB_OVERRIDES.items(): for override, value in DB_OVERRIDES.items():
DATABASES['default'][override] = value DATABASES['default'][override] = value
# NOTE (CCB): Treat all MySQL warnings as exceptions. This is especially
# desired for truncation warnings, which hide potential data integrity issues.
warnings.filterwarnings('error', category=MySQLdb.Warning)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment