Quantcast
Channel: MySQL Forums - Connector/Python
Viewing all articles
Browse latest Browse all 384

Can't Get Result Set as Dictionary (1 reply)

$
0
0
So I'm using MySQL Connector/Python version 2.1.7 to execute a stored procedure. Result set is coming as list of tuples, which is expected. I need column names, so I'm using "dictionary=True" in the cursor declaration per the docs. However, still only returns list of tuples. Docs say it should work since version 2.0.0 of connector.

Here is code:

import mysql.connector
proc = 'audit_report'
parms = [data['schoolid'], dateToISO(data['startdatedefault'],'from'), dateToISO(data['enddatedefault'],'to'), joinIntList(data['studypgms'], joinWith), joinIntList(data['fedpgms'], joinWith), joinIntList(data['statuses'], joinWith), data['fullssndefault']]
conn = mysql.connector.connect(user='myUser', database='myDB', password='myPwd')
cursor = conn.cursor(dictionary=True)
cursor.callproc(proc, parms)

for result in cursor.stored_results():
print(result.fetchall())

So I get the list of tuples, not the list of dictionaries.
Any ideas why this won't work? Is it because I'm calling a store proc instead of executing sql code?

The stored procedure is complex, so there are multiple tables, and crosstabs. Result column names appear just fine when I execute the procedure in MySQL Workbench.

Thanks...

Viewing all articles
Browse latest Browse all 384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>