Created
June 6, 2014 15:23
-
-
Save mmautner/20627496327f08bdf992 to your computer and use it in GitHub Desktop.
A thin pandas/database-backed web app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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