jkklee/pymysql-pool

Last version 0.4.6 doesn't honor cursorclass

fncfnc opened this issue · 3 comments

fncfnc commented

My cursorclass setting is
pymysql.cursors.DictCursor
but I receive a tuple

jkklee commented

that’s not good, but I make a test and I think it's right, can you show me your code? @fncfnc

jkklee commented

@fncfnc, my test code:

import pymysql
import pymysqlpool
ps10=pymysqlpool.ConnectionPool(host="x.x.x.x",database="xxx",user="xxx",password="xxxxxx")
cs10=ps10.get_connection()

# Scenario 1 to get a dict cursor
cus10=cs10.cursor(pymysql.cursors.DictCursor)           
cus10
<pymysqlpool.DictCursor object at 0x10c31d790>      # DictCursor object 
cus10.execute('select 1+1')
1
cus10.fetchall()
[{'1+1': 2}]                              # dict result

##############################

# Scenario 2 to get a dict cursor
ps11=pymysqlpool.ConnectionPool(host="x.x.x.x",database="xxx",user="cld_w",password="xxx",cursorclass=pymysql.cursors.DictCursor)                    
cs11=ps11.get_connection()

cus11=cs11.cursor()
cus11
<pymysqlpool.DictCursor object at 0x10bac5cd0>     # DictCursor object 
cus11.execute('select 1+1')
1
cus11.fetchall()
[{'1+1': 2}]                                # dict result

fncfnc commented

Ok also for me, now the error disappeared.
I don't know what happended, but for sure error happened few second after 0.4.6 release, because a was continuously publishing my AWS Lambda and Lambda exited expecting dict but got tuple.
Could be related for my python environment be Linux/Aarch64?