0

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.

Willmerc
  • 1
  • 1
  • 1
    Probably related to this https://stackoverflow.com/questions/37692780/error-28000-login-failed-for-user-domain-user-with-pyodbc/37702329#37702329 – Ian Wilson May 30 '23 at 16:10
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community May 31 '23 at 06:50

0 Answers0