Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2021 09:06 AM
We can use urllib.parse to handle special characters. Here is an example:
import urllib.parse
user='user@host.mysql.database.azure.com'
password=urllib.parse.quote_plus("P@test")
host="host.mysql.database.azure.com"
database = "db"
connect_args={'ssl':{'fake_flag_to_enable_tls': True}}
connect_string = 'mysql+pymysql://{}:{}@{}/{}'.format(user,password,host,database)
engine = create_engine(connect_string, connect_args=connect_args, echo=False)