1

I am trying to connect to MS SQL server using sqlalchemy and pyodbc and am following all the steps from their own tutorial but it fails. When I debug it, I see that the parameters sent to sqlalchemy are messed up. For example host is username, password is port and so on.

What I am trying to connect to is:

Host = 'host_address123'
Port = 7003
Username = 'user'
Password = 'pass'
DB = 'db-main'

I use the following command:

url = 'mssql+pyodc://Username:Password@Host,port?driver=ODBC+Driver+13+for+SQL+Server'
engine = sal.create_engine(url)

When I try to test a simple query it fails and says creds are wrong or network issues. I know that creds are correct. Can someone help. I'm not married to sqlalchemy and use any other package as long as it works. I keep seeing all the post make it seem very easy but honestly I have been struglling for a long time.

Thanks

mahb
  • 39
  • 6

0 Answers0