Update the sql query in t1_master_replica
Requirement
Introduction:
The t1_master_replica table is a configuration table that stores query-related information. Updates are needed to the t1_query column, which contains queries for loading data into the r_t1_daily_sales table, to ensure smooth execution of the data flow.
Requirement:
Write a Databricks SQL query to update the t1_query column in the t1_master_replica_clone table with the following conditions:
- For country_cd = 'NL' and sequence = 1:
#* Update the t1_query to create a temporary view named nl_wholesaler_insert_query.
#* The view should select all columns from the stg_nl_wholesaler table, excluding Address_Line_1, City, State, and Country.
#* Concatenate the values of these four excluded columns into a single column named Full_address.
- For country_cd = 'NL' and sequence = 2:
#* Update the t1_query to delete all records from the stg_nl_wholesaler table where country_code = 'NL'.
- For country_cd = 'NL' and sequence = 3:
#* Update the t1_query to insert data from the nl_wholesaler_insert_query view into the purgo_playground.r_t1_daily_sales table.
Prerequisite:
- Drop the table t1_master_replica_clone if exist.
- Create replica of t1_master_replica table in t1_master_replica_clone table and perform the requirement in the replica table.
Unity Catalog Information:
The table in scope is purgo_playground.t1_master_replica
Expected Output:
A Databricks SQL query implementing these updates.