Connection freeze to SQL server via PYMSSQL version 2.2.8

285 Views Asked by At

When connecting to SQL with Python it freezes on connection using pymssql, no error, no timeout, just hang there

database_connection = f"mssql+pymssql://{_USERNAME_}:{_PASSWORD_}@{_SERVER_}:{_PORT_}/{_DATABASE_}"
engine = create_engine(database_connection)
connection = engine.connect()

What helped me, was uninstalling pymssql version 2.2.8 and using version 2.2.7

1

There are 1 best solutions below

0
Steve Williams On

This is not an answer but I cannot comment as I am a nooob.

Please see the TDSDUMP piece on https://pymssql.readthedocs.io/en/stable/faq.html

Specifically, you need to add to your code before the connection attempt:

import os
os.environ['TDSDUMP'] = 'stdout'

This will not fix your problem, but at least it will print out into the terminal some clues as to what's going on. Please then "edit" your question to include that dump being careful to redact any sensitive info.