When I try to connect to a sql server database with pyodbc (on mac):
import pyodbc
server = \'####\'
database = \'####\'
username = \'####@####\'
password =
I've tried to establish a connection to a remote MS SQL Server deployed on a (Windows) machine from an external (Linux) machine. It took me some time to realise you need to first install the drivers on the machine that tries establish connection (i.e. Linux in my case)!
If you're using macOS/Linux what you need to do is to simply Install the Microsoft ODBC Driver for SQL Server on Linux and macOS and then follow instructions on Connecting to databases for your particular OS.