denisenkom / pytds

Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation
MIT License
192 stars 53 forks source link

readonly parameter of connect() doesn't seem to work correctly #78

Closed the-hof closed 6 years ago

the-hof commented 6 years ago

I would expect this to set the applicationintent parameter in the connection string, but I'm not sure how to see the actual connection string and I get this error:

pytds.tds.OperationalError: The target database ('DATABASE') is in an availability group and is currently accessible for connections when the application intent is set to read only.

Is there something else that needs to be done?

denisenkom commented 6 years ago

readonly flag is passed here: https://github.com/denisenkom/pytds/blob/3b9bac7dfaab1070c5202acd912ab8154849d0a7/pytds/tds.py#L1420

You can use Wireshark to verify whether this flag is set correctly.