# Get connection
connection = pyodbc.connect(...)
filename = 'MyFile.pdf'
insert = 'insert into FileTable (name, document) values (?,?)'
# open file as binary and read into a variable
with open(filename, 'rb') as f:
bindata = f.read()
# build query
binparams = ('MyFile.pdf', pyodbc.Binary(bindata))
# insert binary
connection.cursor().execute(insert, binparams)
connection.commit()
connection.close()