I have been using pandas in python and I usually write a dataframe to my db table as below. I am now now migrating to Django, how can I write the same dataframe to a table through a model called MyModel? Assistance really appreciated.
# Original pandas code
engine = create_engine('postgresql://myuser:mypassword@localhost:5432/mydb', echo=False)
mydataframe.to_sql('mytable', engine,if_exists='append',index=True)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…