MySQL Upsert is creating unwanted rows

Hi there,

I would like to verify the intended functionality of UPSERT because I’m experiencing unexpected results when using the MySQL Export feature.

My understanding is that the UPSERT should essentially look for the primary key in the database, and anytime it sees a match, then it should update (overwrite the values) for all of the rest of the columns for that row in the database (with the data from the Parabola run).

However, each time I press ‘Run’ it creates new rows in my MySQL database (rather than updating the existing rows as intended). I have verified that the primary key (‘id’) has the exact same numbers in both the database & the Parabola data flow, however the desired update is not happening.

This screenshot shows my settings and primary key column:

This screenshot illustrates how I pressed ‘Run’ 3 minutes apart, and they ended up as new entries in my database (with duplicate IDs) instead of updating the existing ID with new value in the timestamp column:

Do you happen to see where I may be going wrong? I really appreciate it!

Yep, your understanding of UPSERT is correct.

You’re mapping all of your Parabola columns to the columns in your MySQL Database, right? If you want to send us a link to the flow you’re working on, we can take a closer look!

Thank you! Yes, I have mapped them within the MySQL Export step (and used the exact same naming conventions just for good measure). I have PMed you with a link to my flow. Thanks!

Thanks for the additional info. PM received! I’ve ask our engineers to help us look into this. I’m not sure what’s causing this issue. I’ll follow up when I have an update!

Following up! We think that the id column in your database isn’t set up to be a Unique or Primary Key Column. Can you check to make sure the id column is a Primary Key column?

Here’s some info I found on how to set that up:

Thanks so much sachi! You are totally right - After setting the column to Unique, it seems to be Upserting as expected. I really appreciate it.

1 Like

Awesome! Glad to hear it, @John_Doe!