I am trying to bulk update a table using a dataframe using the row id. I tried using the pandas but it didnt work
df.to_sql("collections.tbl_products", engin=local_db_engine, if_exists="replace", index=False, index_label='id', chunksize=10000)
SQL Table (name='tbl_products' schema = 'collections'):
| id | name | product_id |
|---|---|---|
| 1 | apples | 123 |
| 2 | bananas | 456 |
My dataframe:
| id | product_id |
|---|---|
| 1 | 789 |
| 2 | 654 |
I know I could do a row by row update using sql alchemy but how would I do a bulk update using my df?
Note - I'm a complete new beginner at this