cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to update table using merge from value rather than from a table

User16826994223
Honored Contributor III

My question is how can we do an upsert directly, that is, without using a source table. I would like to give the values myself directly.

s there a simple way to do that for Delta tables?

1 ACCEPTED SOLUTION

Accepted Solutions

User16826994223
Honored Contributor III

A source table can be a subquery so the following should give you what you're after.

MERGE INTO events
 
USING (VALUES(...)) // round brackets are required to denote a subquery
 
ON false            // an artificial merge condition
 
WHEN NOT MATCHED THEN INSERT

*

View solution in original post

1 REPLY 1

User16826994223
Honored Contributor III

A source table can be a subquery so the following should give you what you're after.

MERGE INTO events
 
USING (VALUES(...)) // round brackets are required to denote a subquery
 
ON false            // an artificial merge condition
 
WHEN NOT MATCHED THEN INSERT

*

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group