Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

SQLAlchemy Users to JSON code snippet

@app.route('/results/')
def results():
    cols = ['id', 'url', 'shipping']
    data = Table.query.all()
    result = [{col: getattr(d, col) for col in cols} for d in data]
    return jsonify(result=result)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #SQLAlchemy #Users #JSON #code #snippet
ADD COMMENT
Topic
Name
4+6 =