Accessing Azure databases from linux

29 June 2021

Firstly, get hold of some ODBC drivers; Microsoft have a good guide to getting the driver installed for many major distributions (e.g. Ubuntu) here: Install the Microsoft ODBC driver for SQL Server (Linux) - ODBC Driver for SQL Server | Microsoft Docs

Secondly, use pyodbc to find out the driver string and confirm it’s been installed properly

import pyodbc
print(pyodbc.drivers()
# Will print 'ODBC Driver 17 for SQL Server' or similar

Thirdly, sqlalchemy can be used to make it easy to query the database — more detail here