Saturday 20 March 2021

Row size is too large while replacing mysql table with dataframe from python using pymysql

I am writing table to mysql from python using pymysql to_sql function. I am having 1000 rows with 200 columns.

Query to connect to mysql is below:

engine = create_engine("mysql://hostname:password#@localhostname/dbname")
conn = engine.connect()
writing query: df.to_sql('data'.lower(),schema=schema,conn,'replace',index=False)

I am getting below error:

OperationalError: (pymysql.err.OperationalError) (1118, 'Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.')

I have changed column dtypes to string still am getting above error. Please, help me to solve this error.

I am trying to save the table like below. Here, I am providing few columns with create table query.I am getting error while creating the table while saving. CREATE TABLE dbname.table name( 08:00:00 TEXT, 08:08:00 TEXT, 08:16:00 TEXT, 08:24:00 TEXT, 08:32:00 TEXT, 08:40:00 TEXT, 08:48:00 TEXT, 08:56:00 TEXT, 09:04:00 TEXT, 09:12:00 TEXT, 09:20:00 TEXT, 09:28:00 TEXT)



from Row size is too large while replacing mysql table with dataframe from python using pymysql

No comments:

Post a Comment