Skip to content

Instantly share code, notes, and snippets.

@cwade
cwade / sql_server_from_python.md
Last active August 28, 2023 15:23
Using Python to connect to a Microsoft SQL Server database from OS X using Windows authentication

There are many instructions out there on how to do this, but none quite worked for me. I'm currently on a Mac running OS X Mojave (10.14.4)

These instructions got me closest, but I still couldn't get the python part of the equation to work.

Here's what worked for me.

First, install unixodbc using Homebrew. I highly recommend using Homebrew here because it's a little more complicated to install on its own.

brew install unixodbc
@brijeshb42
brijeshb42 / app.py
Last active September 25, 2020 20:16
import os
import json
import datetime
from flask import Flask, url_for, redirect, \
render_template, session, request
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager, login_required, login_user, \
logout_user, current_user, UserMixin
from requests_oauthlib import OAuth2Session