Hi I am curently trying to connect to an azure database through a python module.
When I format a connection string like this
connection_string = f"{sql_config['driver']}://{username}:{password}@{sql_config['host']}:{sql_config['port']}/{sql_config['database']}?driver=ODBC+Driver+17+for+SQL+Server;Encrypt=yes;TrustServerCertificate=no;"
connection = create_engine(connection_string)
When the host has a colon in the name such as "tcp:servername.database.windows.net", it will return ValueError: invalid literal for int() with base 10: 'servername.database.windows.net:1433' as it thinks the colon separates the host and the port. Is there anyway to escape the character? I have tried using {}, '', "" to escape the colon to no success.
I would like to keep the connection string as an URL.