sqlite3.InterfaceError: Error binding parameter 1 - probably unsupported type

前端 未结 2 1043
野趣味
野趣味 2021-01-01 17:04

I am having this annoying error that I could not solve.. here is my function

def savePicture(pic):
try:
    connection=sqlite3.connect(\'/home/faris/Desktop/         


        
相关标签:
2条回答
  • 2021-01-01 17:17

    Ok, That is stupid lol

        pic.caption,
        pic.created_time,
    

    are not TEXT type..but the error msg is saying the problem from pic.user.profile_picture. thus, if you have this error just check all the parameters :)

    Read the comment below :)

    0 讨论(0)
  • 2021-01-01 17:18

    The easiest way to solve that issue is- convert all the dataframe columns into str, and apply to_sql method. df = df.applymap(str) otherwise, you can change the data types of each column that are compatible with SQLite datatypes before saving the dataframe into SQLite table. dtype parameter of to_sql method would be useful to convert the datatypes of the columns while inserting the data into SQL table.

    0 讨论(0)
提交回复
热议问题