How to pass connection parameter "ApplicationIntent=ReadOnly" when using pymssql

I only have readonly access to a SQL Server db. How do I pass connection parameter "ApplicationIntent=ReadOnly" when using pymssql to connect to the database? If pymssql doesn't support it, is there any other python library that I can use?

Answers


Because pymssql is dependent on FreeTDS You really need to address the connection parameters to your MS-SQL server used by FreeTDS

Because ApplicationIntent is listed in the freetds user guide as an option you should be able to use it.


The only way to configure readonly connection intent with pymssql seems to be to configure freetds on which it's based, but it did not work out for me. I've had to use pyodbc instead of pymssql

from pyodbc import connect
conn = connect(
    'DRIVER={ODBC Driver 17 for SQL Server};SERVER=' + host + ';PORT=' + port + ';DATABASE='
    + database + ';UID=' + user + ';PWD=' + password + ';ApplicationIntent=ReadOnly')

pyodbc has a readonly parameter. For example:

import pyodbc
conn = pyodbc.connect(driver='{SQL Server}', host=Server, database=Database,
                  trusted_connection='yes', user='', password='', readonly = True)

Need Your Help

pause build and start another build

jenkins continuous-integration jenkins-plugins jenkins-cli

I am trying to implement continuous integration using Jenkins and i came across below scenario.

How to change font size in VB.net

.net email

I want to below script to send an email to lotus notes, but I find that in lotus notes, the font size of body message is a little bigger, so I want to change its font size to a small one, but due to