python create_engine mysql with special character

Viewed 14

I got the following function

username = "root"
password = "@vdfe098"
host = "mysql.domain.local"
port = "3306"
database = "test"

def get_connection():
    return create_engine(
       url = "mysql+pymysql://:{0}:{1}@{2}:{3}/{4}".format(
           username, password, host, port, database
    )
)


but it seems to have issue connecting to the mysql server with the special character "@"

any idea how to solve this?

0 Answers
Related