I'm trying to connect to a database in python. The connection string is
engine2 = create_engine(fr"mssql+pyodbc://domain\username:password@hostname:port/database?driver=SQL+Server")
When I use the read_sql function to try and connect and run some SQL the error message returned states that the login has failed for user 'domain\username' so I think the problem here is dealing with the backslash being an escape character. I've tried writing the string with a double backslash to escape the escape character but that returns 'domain\\username'. Any help would be great. Thanks.