Use utf8mb4 charset for the DB connection to MySQL

This commit is contained in:
Marcus Lindvall 2018-10-10 12:03:46 +02:00
parent 351d98c523
commit 3c3a03a5ae

View file

@ -10,7 +10,7 @@ class MySQLSession(Session):
"""docstring for MySQLSession""" """docstring for MySQLSession"""
def __init__(self, settings): def __init__(self, settings):
self.engine = create_engine( self.engine = create_engine(
'mysql+pymysql://{user}:{passwd}@{host}:{port}/{db}'.format(**settings)) 'mysql+pymysql://{user}:{passwd}@{host}:{port}/{db}?charset=utf8mb4'.format(**settings))
super(MySQLSession, self).__init__(bind=self.engine) super(MySQLSession, self).__init__(bind=self.engine)
def create_db(self): def create_db(self):