awswrangler redshift to_sql upserting specific columns

Viewed 18

Suggest we have a table with a row like below.

tag value before the update operation

I want to update just col_id and slug columns with a new values.

this is the code line I use to update this row.

df = pd.DataFrame([[datas.get("collection_id"), datas.get("slug")]], columns=["col_id", "slug"])

wr.redshift.to_sql(
        df=df, table="test_db", schema="offchain", con=con, use_column_names=True, mode="upsert")

after this operation the row updated like below. tag value becomes NULL after the update operation

but I just want that update col_id and slug. keep the tag column the same now as it was before.

I try to find method to update just specific columns of rows. When I try tı use use_column_names it should be update given columns. But in this example it is updating tag column by NULL.

0 Answers
Related