I have the following function that yields a pyodbc.connect() object to use with a with statement:
pyodbc.connect()
with
from contextlib import contextmana