Recipes for maintaining SCDs in Snowflake
Understanding the structure of an SCD and being able to load it correctly are very different concepts. With a firm grasp of SCD types, we will now cook up the recipes for creating and maintaining them in Snowflake. Unlike generic SQL techniques you may have used in other databases, this book will take full advantage of the cost- and time-saving capabilities of Snowflake’s core features, such as streams and zero-copy cloning.
Setting the stage
To give readers complete autonomy to construct, experiment, and modify the upcoming exercises, we will first create a base table that will simulate the day one snapshot of the data warehouse raw/source schema. The base table will represent the initial first load of the source data into the data warehouse. Next, we construct a routine that simulates a daily load of new and changed records.
For consistency with the first half of this chapter, these examples will use the CUSTOMER
table from...