Python Forum

Full Version: MySQL not accepting utf8mb4. Warning 3719
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm connecting to my MySQL 8 database OK but it issues me with a warning when I run my python script:

Warning: (3719, "'utf8' is currently an alias for the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.")
cursor.execute(statement, parameters)


not sure why it thinks it's UTF8? Anyhow, after searching on Google, I created a test database with 1 table that is defined as such:

CREATE SCHEMA cicd_loadrunner DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE cicd_loadrunner.lr_testname (
id INT NOT NULL AUTO_INCREMENT,
test_name VARCHAR(255) CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci NOT NULL,
deleted VARCHAR(1) CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (id))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;


Python:
engine = create_engine('mysql+mysqldb://root:mysqltest@localhost/cicd_loadrunner')
connection = engine.connect()

print (engine.table_names())
So not sure what I'm doing wrong here? Do I need to do anything else on the Python side that I'm missing? Or is it in purely in the database?

PS. Hit send too quickly :) I double checked and utf8mb4 is a valid type for MySQL 8; I'm using python libs sqlalchemy and mysqlclient.

Cheers,
J