I have DataFrame that is needed to save as a table. I used this one and it works well.
result.to_sql(
'tbl_name',
index_label='date',
dtype={'date': Date},
con=engine.connect(), if_exists='append', index = True
)
The difficult problem is that I can not find a way to set Primary Key
for the table. I need to define date
(Date) and symbol
(String) as Primary Key
. As it is impossible to set primary key for sqlite3
after creation, I think there must be a way to set primary key when using to_sql
, but could not find. Can anybody help me?
Thank you.