Search code examples
sqlalchemyconnection-stringfreetdspymssql

SqlAlchemy connection string using pymssql


Is there an equivalent of odbc_connect in pymssql using freeTDS driver?

For example using pyodbc I can use connect within the connection string itself and then pass all required parameters:

conn_string = ("mssql+pyodbc:///?autocommit=true&odbc_connect={}".format(parameters)

Is it possible to use &connect={} within the string using pymssql & freeTDS in SQLAlchemy?


Solution

  • No, because odbc_connect= is part of the pyodbc driver code in SQLAlchemy and the pymssql driver code has no corresponding option. That said, pymssql was actively supported in SQLAlchemy until recently, so if you need to pass any extra options to pymssql there is probably a way to do it. Check the documentation for details.