In the interim you can use pymssql - eg:

import os, sys, web, json
import pymssql

prog_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(prog_dir)

urls = (
    '/'           , 'Index',
    '/districts'  , 'Districts',
)

app = web.application(urls, globals())
application = app.wsgifunc()

templates_dir = os.path.join(prog_dir,'templates/')
render = web.template.render(templates_dir)

conn = pymssql.connect(host='host', user='user', password='pwd', 
database='db')

class Index:
    def GET(self):
        return render.index()

class Districts:
    def GET(self):
        res=[]
        cur = conn.cursor()
        cur.execute('SELECT DISTNAM FROM DB_DISTRICTS')
        columns = tuple( [d[0].decode('utf8') for d in cur.description] )
        for row in cur:
            res.append(dict(zip(columns, row)))
        d = {'items':res}
        web.header('Content-Type', 'application/json')
        return json.dumps(d)

if __name__ == "__main__":
    app.run()

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/webpy/-/3c_8RvUzHm0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to