Get started • Data Lake

Update or add rows by key

Merge rows into a table by a key: matching rows are updated, new ones are added.

Try this

  • In samples.daily_sales, update or add these two rows, matching on date and store. 2026-03-02, north: 250 units, price 9.49, no promotion, 600 visitors. 2026-07-07, north: 240 units, price 9.49, no promotion, 580 visitors. Show me the preview first.

Your assistant may word its answers differently each time; the numbers come from your tables.

Change it if it's there, add it if it's not

What is it?

Think of your phone's contacts. If a friend is already there, you change their number. If not, you add them. You never get the same friend twice. The odd name for this is upsert: update plus insert.

How does it know a row is already there?

You tell it what makes a row special. Here it is the date and the store together.

What happens first?

It shows you a preview. With these two rows it should say: 1 would be updated and 1 would be added. Nothing changes until you say yes.

Be careful

Give the whole row, not just the part you are changing.

Before you start

Load the sample data first. It is step 1 on the Data Lake quickstart page.

Make it yours

Your assistant needs the real names. Replace the table and column names in the prompt above with yours. If you are not sure of them, ask first: "Describe my table called orders."

Then ask

Each question builds on the last answer. Ask follow-ups in plain words.

"That looks right. Apply it."

"Undo my last change to samples.daily_sales."