SQLAlchemy & Pandas --> .to_sql() not insert all the rows

156 views Asked by At

I try to insert into a mysql database a dataframe, the dataframe have 619.008 rows

with this code it inserts the rows very fast, but it don't insert all the rows, it insert around 590.000 every execution it change the number

I try to change the chunksize to high and less values and it happens the same

from sqlalchemy import create_engine

# SQLAlchemy & Pandas

engine = create_engine("mysql+pymysql://{user}:{pw}@localhost/{db}"
.format(user="xxxx",
pw="xxxxx",
db="xxxxx"))

chunksize = 300
df.to_sql('cmd_pom_eventos3', engine, chunksize=chunksize,
method='multi', index=False, if_exists='append')

Do you know why it doesn't insert all the rows?

thanks

0

There are 0 answers