Hi
I am new to databricks and still learning.
I am trying to do a CDC on a table.
APPLY CHANGES INTO LIVE.table1
FROM schema2.table2
KEYS (Id)
SEQUENCE BY orderByColumn
COLUMNS * EXCEPT (col1, col2)
STORED AS SCD TYPE 1 ;
table1 is in schema1 and is silver layer. table2 is in schema2 and is bronze layer.
- table2 may have different, new columns than table1. how do I insert or update these new columns into table1. I am assuming that would give us schema mismatch errors.
- I want to insert some new columns based on the whether the operation is an insert operation or an update operation. If it is an update operation, I want to insert a column called 'LastModifiedDate' with the current timestamp and if it is an insert operation I want to insert a column called 'CreatedDate' as current timestamp.
How can I do these 2 things?
Thanks in advance.