Skip to content Skip to sidebar Skip to footer

Pass Data From Mysql To An Api In Flask

I need to convert data from mySQL to JSON in Python using Flask. I'm use the conversion directly in mySQL but it gives me error. this is the code. @app.route('/getdata') def getdat

Solution 1:

You should be using cursor.fetchall() or cursor.fetchmany() to get the data from the cursor. Documentation here

The cursor object is NOT the data! , its just a handler that helps you get the data.

Post a Comment for "Pass Data From Mysql To An Api In Flask"