Search code examples
sqlsql-updatesnappydata

sql update table from another table snappydata


Hi I am using SnappyData's sql utility to update table my table from another table, say update Table_A with rows from Table_B.

Table_A(col_key, col_value) -- partitioned table with large number of rows 
Table_B(col_key, col_value) -- small batch update in this table

Ideally a MERGE would be ideal (update if there is a match, or insert if the row with the key does not exists in Table_A)

But MERGE is not supported in SnappyData (or Gemfire), thus I am planning to insert first with an outer join to handle new col_key rows, then an update to update values in Table_A where the same col_key also appears in Table_B.

However it seems that the "update ... set ... from ... " is also not supported in Gemfire

So is there a way to implement the "update .. set .. from .." in SnappyData sql statements? Thanks in advance :)


Solution

  • Yes, you can use PUT INTO when using SQL or you can do the same using the Snappy Spark extension APIs too.