I'not able to correctly store a ml gridsearch in database with pickle

Viewed 28

I'm trying to store a machine learning gridsearch model with pickle into a database using python. I correctly convert the model in pickle, connect to db but when I try to insert the model in the table i just created it produces:

"TypeError: not all arguments converted during string formatting".

Any suggestion would greatly be appreciated (following the code):

pickledList = pickle.dumps(estimator_rand_for)
connection = pymysql.connect(xxxxx,yyyyy,zzzz,jjjj)
cursor = db.cursor()
cursor.execute("""create table if not exists tab1 ( pkl longtext)""")
cursor.execute("""insert into tab1 (pkl) VALUE (?)""", [pickledList] )

thank you!

0 Answers
Related