May-09-2019, 07:04 AM
Hi,
I’m trying to extend on the assistance I have received here but with a slightly different scenario. This time I am using a select statement (not a stored procedure)
In addition, I want to take the easy path of just using column headers instead of having to type them all out
My attempt so far has been
Thanks in advance
Todd
I’m trying to extend on the assistance I have received here but with a slightly different scenario. This time I am using a select statement (not a stored procedure)
In addition, I want to take the easy path of just using column headers instead of having to type them all out
My attempt so far has been
cursor = cnx.cursor(dictionary=True) query = ("SELECT * FROM vw_myview order by vw_myview.ItemID") cursor.execute(query) rows = cursor.fetchall() json_rows = list.append(dict(zip(rows.column_names, row))) cursor.close() cnx.close() return { 'statusCode': 200, 'headers': {'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json'}, "body": json.dumps(json_rows) }Error I get is ‘list object has no attribute named column_names
Thanks in advance
Todd