I can successfully add emoji (i.e. utf8mb4 data) to tables using mysql using the terminal.
When my Python Flask website tries to send emoji to the same database tabl
Python Flask defaults to communicating with MySQL in MySQL's utf-8, i.e. it can't handle the full utf8mb4 range (which includes emojis). Flask will override the database charset settings, including the character-set-server setting in my.cf. Adding the following setting to the Flask app fixes the problem by forcing it to communicate with MySQL in utf8mb4:
app.config['MYSQL_DATABASE_CHARSET'] = 'utf8mb4'