Skip to content

Instantly share code, notes, and snippets.

@mmautner
Created June 6, 2014 15:23
Show Gist options
  • Save mmautner/20627496327f08bdf992 to your computer and use it in GitHub Desktop.
Save mmautner/20627496327f08bdf992 to your computer and use it in GitHub Desktop.
A thin pandas/database-backed web app
#!/usr/bin/env python
from pandas.io.sql import read_sql
import MySQLdb
from flask import Flask
app = Flask(__name__)
qry = "select * from adh_bayescomp_msn limit 100"
db = MySQLdb.connect(read_default_file="~/.my.cnf.quark")
@app.route('/')
def index():
df = read_sql(qry, db)
return df.to_html()
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment