You've spent weeks in data warehousing classes, days in training sessions, hours reading books on the subject, and perhaps years warehousing data for other organizations. However, right now you want to work for this one. You know that you have the experience as well as the ambition. You have a list of ideas to take to this new potential employer that you know will provide immense value. So, what's the next step? All of that is placed onto a very professionally-looking resume and submitted. The only problem is that everybody else has done that same thing. You are not known as "Bob, who will add huge value to the business intelligence team," you are known as applicant 27...just another resume in the stack.
Perhaps you are on the other end of the spectrum. You are a novice looking for your first data warehousing position with no prior experience outside of class. You need a way to actually show that despite your lack of work experience you can do this...and do it well.
Do you need a fresh approach to marketing your skillset in hopes of standing out in the crowd? It is interesting that those in the event industry are expected to provide samples of their work for potential clients. Cake decorators, wedding photographers, and other similar vendors would probably be passed over if they only provided a resume that explained what they had done before or what their education claims that they are capable of doing.
What if you placed a sample of your data warehousing skillset onto the web specifically for a potential employer to browse? In other words, you would have a resume to provide the details of your experience and education and a portfolio to provide an example of what you can actually do. The Data Warehouse Portfolio is a book that suggests a way to accomplish this. More information is available at www.brianciampa.com. You may also want to revisit this prior blog post for a bit more information as well.
Your job is to turn data into valuable data. However, showing the value in yourself is the first step in getting that job.
Friday, August 17, 2012
Friday, August 10, 2012
ETL - Practice Loading a Dimension - Solution
In the previous post we looked at the process used to write a basic ETL job to populate a dimension table. As discussed previously, while no two developers will write one exactly the same way, an ETL job that populates a dimension table will need to accomplish the following...
1.) Extract all of the dimension attributes from the source.
2.) Transform the data according to the requirements (i.e., concatenate first name and last name to create a full name column, etc.)
3.) Identify those records that are new to the table as opposed to those records that already exist in the table and may need to be updated due to updates in the source system
4.) Generate new surrogate key values and add them to the new records
5.) Load the records into the dimension table
Consider this example of an Oracle PL/SQL procedure that will populate the DIM_PRODUCT table. Before running the procedure keep these things in mind...
1.) I made an error in the SQL file from the previous post, so you may want to re-download that and run it again. The DIM_PRODUCT.PRODUCT_EFFECTIVE_FLAG should be named DIM_PRODUCT.PRODUCT_ACTIVE_FLAG.
2.) This job depends on an Oracle sequence to create the surrogate keys. Before running the job, run this statement in your Oracle environment...
CREATE SEQUENCE
SEQ_DIM_PRODUCT
MINVALUE 0
INCREMENT BY 1
START WITH 1;
3.) I'll encourage you not to get too lost in the Oracle syntax. The point is to examine the logical flow of an ETL job. If you have a better way of structuring the Oracle code (or want to use something other than Oracle), then by all means do that.
Run the procedure (after you have created the sample data provided in the previous post, of course) to populate the DIM_PRODUCT dimension. Notice what is happening...
1.) Extract all of the dimension attributes from the source - Everything is pulled from the source system and placed into the STAGE_PRODUCT_EXTRACT table.
2.) Transform the data according to the requirements (i.e., concatenate first name and last name to create a full name column, etc.) - The PRODUCT_ACTIVE_FLAG is derived and that data is placed into the STAGE_PRODUCT_TRANSFORM table.
3.) Identify those records that are new to the table as opposed to those records that already exist in the table and may need to be updated due to updates in the source system - New records are identified (via an outer join) and placed into the STAGE_PRODUCT_LOAD table.
4.) Generate new surrogate key values and add them to the new records - Surrogate keys are created in the STAGE_PRODUCT_LOAD table using the Oracle sequence mentioned earlier.
5.) Load the records into the dimension table - Existing records are updated in the DIM_PRODUCT table and the new records from the STAGE_PRODUCT_LOAD table are loaded.
This job is designed to be run as many times as necessary. Running one time or multiple times should still result in 25 records being placed into the DIM_PRODUCT table. This is a simple example for a few reasons, one of which is that we are working with a very small amount of data. A more complex ETL job may examine the source system's data and somehow determine which records are new and/or have been updated before pulling them into the staging area.
Also, more complex ETL jobs may not have five simple steps, as this one does, to accomplish the five things listed above. It may take several steps to accomplish those five things due to the complexity of the data.
If you wish, change some of the source data to see the updates occur or tweak the ETL job to your liking. By running this ETL job, you have just turned ordinary data into something that is truly valuable.
Image: FreeDigitalPhotos.net
1.) Extract all of the dimension attributes from the source.
2.) Transform the data according to the requirements (i.e., concatenate first name and last name to create a full name column, etc.)
3.) Identify those records that are new to the table as opposed to those records that already exist in the table and may need to be updated due to updates in the source system
4.) Generate new surrogate key values and add them to the new records
5.) Load the records into the dimension table
Consider this example of an Oracle PL/SQL procedure that will populate the DIM_PRODUCT table. Before running the procedure keep these things in mind...
1.) I made an error in the SQL file from the previous post, so you may want to re-download that and run it again. The DIM_PRODUCT.PRODUCT_EFFECTIVE_FLAG should be named DIM_PRODUCT.PRODUCT_ACTIVE_FLAG.
2.) This job depends on an Oracle sequence to create the surrogate keys. Before running the job, run this statement in your Oracle environment...
CREATE SEQUENCE
SEQ_DIM_PRODUCT
MINVALUE 0
INCREMENT BY 1
START WITH 1;
3.) I'll encourage you not to get too lost in the Oracle syntax. The point is to examine the logical flow of an ETL job. If you have a better way of structuring the Oracle code (or want to use something other than Oracle), then by all means do that.
Run the procedure (after you have created the sample data provided in the previous post, of course) to populate the DIM_PRODUCT dimension. Notice what is happening...
1.) Extract all of the dimension attributes from the source - Everything is pulled from the source system and placed into the STAGE_PRODUCT_EXTRACT table.
2.) Transform the data according to the requirements (i.e., concatenate first name and last name to create a full name column, etc.) - The PRODUCT_ACTIVE_FLAG is derived and that data is placed into the STAGE_PRODUCT_TRANSFORM table.
3.) Identify those records that are new to the table as opposed to those records that already exist in the table and may need to be updated due to updates in the source system - New records are identified (via an outer join) and placed into the STAGE_PRODUCT_LOAD table.
4.) Generate new surrogate key values and add them to the new records - Surrogate keys are created in the STAGE_PRODUCT_LOAD table using the Oracle sequence mentioned earlier.
5.) Load the records into the dimension table - Existing records are updated in the DIM_PRODUCT table and the new records from the STAGE_PRODUCT_LOAD table are loaded.
This job is designed to be run as many times as necessary. Running one time or multiple times should still result in 25 records being placed into the DIM_PRODUCT table. This is a simple example for a few reasons, one of which is that we are working with a very small amount of data. A more complex ETL job may examine the source system's data and somehow determine which records are new and/or have been updated before pulling them into the staging area.
Also, more complex ETL jobs may not have five simple steps, as this one does, to accomplish the five things listed above. It may take several steps to accomplish those five things due to the complexity of the data.
If you wish, change some of the source data to see the updates occur or tweak the ETL job to your liking. By running this ETL job, you have just turned ordinary data into something that is truly valuable.
Image: FreeDigitalPhotos.net
Friday, August 3, 2012
ETL - Practice Loading a Dimension
We've been looking recently at the concept of extract, transform, and load (ETL) jobs. This post will begin to examine some of the mechanics. When loading a dimension table the ETL job should accomplish the following things...
1.) Extract all of the dimension attributes from the source.
2.) Transform the data according to the requirements (i.e., concatenate first name and last name to create a full name column, etc.)
3.) Identify those records that are new to the table as opposed to those records that already exist in the table and may need to be updated due to updates in the source system
4.) Generate new surrogate key values and add them to the new records
5.) Load the records into the dimension table
Each ETL job that populates a dimension table will need to accomplish these five things, although no two developers will develop a job exactly the same way. To get a feel for this type of job, consider this very simple example. A source system contains these two tables among others (click the picture to enlarge)...
...and this dimension needs to be populated...
If you have an Oracle environment available to you, run this sql file to create the two source system tables, populate them with data, and create the DIM_PRODUCT table. Each product, as you can see, is grouped under a single product group. The PRODUCT_EFFECTIVE_FLAG indicates whether or not a product is currently effective (current at the time of the ETL job). If you wish, try to write an ETL job that will populate the DIM_PRODUCT table in PL/SQL or another language of your choosing. We will examine a possible solution in a future post.
1.) Extract all of the dimension attributes from the source.
2.) Transform the data according to the requirements (i.e., concatenate first name and last name to create a full name column, etc.)
3.) Identify those records that are new to the table as opposed to those records that already exist in the table and may need to be updated due to updates in the source system
4.) Generate new surrogate key values and add them to the new records
5.) Load the records into the dimension table
Each ETL job that populates a dimension table will need to accomplish these five things, although no two developers will develop a job exactly the same way. To get a feel for this type of job, consider this very simple example. A source system contains these two tables among others (click the picture to enlarge)...
...and this dimension needs to be populated...
If you have an Oracle environment available to you, run this sql file to create the two source system tables, populate them with data, and create the DIM_PRODUCT table. Each product, as you can see, is grouped under a single product group. The PRODUCT_EFFECTIVE_FLAG indicates whether or not a product is currently effective (current at the time of the ETL job). If you wish, try to write an ETL job that will populate the DIM_PRODUCT table in PL/SQL or another language of your choosing. We will examine a possible solution in a future post.
Saturday, July 21, 2012
Extract, Transform, and Load Video
As a continuation of our discussion of ETL, consider this YouTube video, which is also available at http://www.youtube.com/brianciampa. Designing the star or snowflake schema is a great start. However, the ETL populates that star, thus transforming your data into something that is truly valuable. In a future post we will look at an example of a basic ETL job in Oracle.
Friday, July 13, 2012
Extract, Transform, and Load (ETL)
In prior posts, we’ve looked a bit at the basic structure of a star schema but we have not looked at populating a star schema. Populating a data warehouse is accomplished using an extract, transform, and load (ETL) job. This is a job that pulls data from the source system, transforms it into a structure appropriate for the data warehouse, and then loads that data into the data warehouse. The concept of ETL is not unlike any other craft or trade. Consider the following…
1.) A math student reads and understands the math problem from the textbook (extract), uses a piece of scrap paper, if calculators are not allowed, to find the solution (transform), and places the answer onto the final answer sheet (load).
2.) A carpenter purchases wood from a supplier (extract), uses his workshop to design, measure, sand, cut, etc. (transform), and then delivers the final product to the customer (load).
Usually, the transformation piece is accomplished inside of a separate schema in the database, called a staging area. The data from the source system is placed into this area and then restructured so that it is appropriate for the star schema, much like the math student uses the scrap paper and the carpenter uses the workshop. It is generally accepted that this area is for the ETL developer’s eyes only. End users do not have access to data in the staging area, much like a customer is not involved in the carpenter’s workshop and the math student does not place his chicken scratch on the sheet with the final answer. Once that data has been transformed, it is placed into the star schema and is ready for analysis.
It may be worth noting that some variations of ETL, such as ELT (extract, load, and transform), ETLT (extract, transform, load, and transform), and others, are used to describe methods by which jobs will populate a data warehouse using a different order than the standard extract then transform then load order. In order to encompass all of these terms, the term data integration (or something similar) is often used to describe data warehouse population in a general sense.
For more information on data warehousing concepts, remember to visit http://www.brianciampa.com/.
Image: FreeDigitalPhotos.net
Friday, June 29, 2012
Big Data Defined
A typical question asked of business intelligence professionals is - what is big data? In a previous post I provided some explanation of the big data challenge. As I've learned more about this very interesting piece of business intelligence, I believe that a more complete explanation is available. Consider this...
Suppose you own a day care, meaning that you are in the business of caring for children each day. You have determined that in order for you to have a truly challenging day, three things have to occur. First, you must have a large number of kids to care for on that given day. How large is large? There are no hard and fast rules...large enough that your current resources are strained at best and inadequate at worst. Second, let's assume that you have no help, meaning that you need to know what each child is doing right now. Not knowing what one of them was doing for an hour and then finding out later that he was painting the refrigerator is not acceptable. Third, you have a very diverse group of kids. This does not refer to diversity with regards to race or ethnicity but diversity with regards to personality. Some of the kids love to play outside and some inside. Some are into puzzles and others are into riding bicycles. As a result, keeping the kids engaged in activities that they enjoy and in which they are gifted can be challenging.
If two of the three challenges exist, the day is still challenging but not to the same extent. You can know what each child is doing in a diverse group if you have a small number of them. You can deal with a large number of kids if they are ALL sitting in the same room, doing the same thing. It's the combination of the three problems that presents a challenge. Now, consider this in terms of big data. Big data is characterized as having three V's.
1.) Volume - In order to data to be considered big data it must be large. How large is large? I'm not so sure that there is a hard and fast boundary between "normal" data and big data in terms of size. However, I would assume that if managing the data for the purposes of business intelligence presents problems because of its size, then this V applies.
2.) Velocity - Part of the big data problem involves dealing with the speed at which the data comes in. Decision makers want to know what is happening in their business and in the marketplace now, as opposed to experiencing a lag. For example, if an announcement was just made with regards to a new line of business, what are people saying about that on Twitter now? If there is a need to stream data in some way so that it can be analyzed in real time, then this V applies.
3.) Variety - Part of the big data problem involves dealing with various types of data. Relational databases are good at storing structured data. Structured data is data in which each element is placed into a fixed area (such as columns and rows in a database or an XML schema) that was created for that specific element's characteristics. Dates belong here, integers belong there, etc. Unstructured data, such as a tweet or the body of an email message, are more free form. In other words, there is nothing governing the type of data that is stored in those environments. If decision makers want to analyze various types of data (such as both structured and unstructured data) then this V applies.
While challenges may exist when experiencing only one or two of the above mentioned V's, the industry generally agrees that if all three characteristics apply to your data, then you have big data.
Also, remember to visit http://www.brianciampa.com/ for more information on data warehousing and business intelligience.
Image: FreeDigitalPhotos.net
Suppose you own a day care, meaning that you are in the business of caring for children each day. You have determined that in order for you to have a truly challenging day, three things have to occur. First, you must have a large number of kids to care for on that given day. How large is large? There are no hard and fast rules...large enough that your current resources are strained at best and inadequate at worst. Second, let's assume that you have no help, meaning that you need to know what each child is doing right now. Not knowing what one of them was doing for an hour and then finding out later that he was painting the refrigerator is not acceptable. Third, you have a very diverse group of kids. This does not refer to diversity with regards to race or ethnicity but diversity with regards to personality. Some of the kids love to play outside and some inside. Some are into puzzles and others are into riding bicycles. As a result, keeping the kids engaged in activities that they enjoy and in which they are gifted can be challenging.
If two of the three challenges exist, the day is still challenging but not to the same extent. You can know what each child is doing in a diverse group if you have a small number of them. You can deal with a large number of kids if they are ALL sitting in the same room, doing the same thing. It's the combination of the three problems that presents a challenge. Now, consider this in terms of big data. Big data is characterized as having three V's.
1.) Volume - In order to data to be considered big data it must be large. How large is large? I'm not so sure that there is a hard and fast boundary between "normal" data and big data in terms of size. However, I would assume that if managing the data for the purposes of business intelligence presents problems because of its size, then this V applies.
2.) Velocity - Part of the big data problem involves dealing with the speed at which the data comes in. Decision makers want to know what is happening in their business and in the marketplace now, as opposed to experiencing a lag. For example, if an announcement was just made with regards to a new line of business, what are people saying about that on Twitter now? If there is a need to stream data in some way so that it can be analyzed in real time, then this V applies.
3.) Variety - Part of the big data problem involves dealing with various types of data. Relational databases are good at storing structured data. Structured data is data in which each element is placed into a fixed area (such as columns and rows in a database or an XML schema) that was created for that specific element's characteristics. Dates belong here, integers belong there, etc. Unstructured data, such as a tweet or the body of an email message, are more free form. In other words, there is nothing governing the type of data that is stored in those environments. If decision makers want to analyze various types of data (such as both structured and unstructured data) then this V applies.
While challenges may exist when experiencing only one or two of the above mentioned V's, the industry generally agrees that if all three characteristics apply to your data, then you have big data.
Also, remember to visit http://www.brianciampa.com/ for more information on data warehousing and business intelligience.
Image: FreeDigitalPhotos.net
Friday, June 22, 2012
Snowflake Schema
Going back to the piggy bank example from this blog's first post, we know that the value of a data warehouse lies with allowing a user to analyze data easily. This is mainly achieved through denormalization. This often differs from the value of a source system which lies with getting data into the system quickly. This is mainly achieved through normalization.
So, if we were to run a select statement against a source system that is designed to return (among other things) an employee name as well as his department, those two things may be stored in two tables. The employee table may simply store a foreign key to the department table, which stores the names of the departments. The query may find 'John Smith' in the employee table and then the number 6 in the department field. The database will have to go to the department table, look up the row with the number 6 to see that the value is 'Human Resources' and then return those two values, along with any other values that were specified in the select statement, in the query results. Doing this for several rows and for several different kinds of values will take some time.
In a typical data warehouse design, however, all of these values may exist in the same table and be repeated. This way, the query can go to one table and find 'John Smith' and 'Human Resources' without having to translate a foreign key. This keeps things quick.
However, there are some instances in which some normalization is appropriate in a star schema. This normalization is not to the extent that it exists in the source system, which is often third normal form, but it is normalization none the less. Consider the ERD below (click on it to expand)...
This is yet another addition to the star schema that we have been using for the past several weeks. Notice the DIM_EXECUTIVE table at the bottom. It is a dimension table that is joined directly to the DIM_EMPLOYEE dimension table. It is not joined to the fact table. Why would we not add the four non-key values directly to the DIM_EMPLOYEE table? We could and that would not be incorrect, but what if there is not much executive information compared to the number of employees?
So, if the DIM_EXECUTIVE table contains 10 rows and the DIM_EMPLOYEE table contains 4,000,000 rows, then placing this executive information into the DIM_EMPLOYEE table will result in 3,000,990 rows of empty space. In this case, it might make sense.
When a dimension table joins to another dimension table the star schema is now referred to as a snowflake schema. The "second layer" of dimension tables causes the tables, when they are depicted in an ERD, to resemble a snowflake.
I will add that when in doubt, it is probably best not to snowflake. Snowflaking causes some additional complexity on the part of the reporting tools when it comes to interpreting the data.
To experiment with analyzing this kind of data, you can run the script found here in an Oracle environment. Rather than continue adding to the script little by little, this script will create ALL of the tables and data depicted in the ERD. As with last week's post on junk dimensions, you have some options with regards to snowflaking or not. Remember that your number one goal is to turn your organization's data into something that is truly valuable, thus enabling your leaders to make excellent decisions. Make your decision with that in mind.
More on snowflaking can be found in the books listed in the additional reading section to the right as well as by visiting http://www.brianciampa.com/ and, under the Concepts menu, clicking Terms or Advanced.
Update: The Kimball training that I received taught me that I was incorrect in classifying this type of design as a snowflake schema. A snowflake schema contains a completely normalized version of the dimension tables. This post describes an outrigger table. The example above should still be considered a star schema. Sorry for my mistake.
Image(s): FreeDigitalPhotos.net
So, if we were to run a select statement against a source system that is designed to return (among other things) an employee name as well as his department, those two things may be stored in two tables. The employee table may simply store a foreign key to the department table, which stores the names of the departments. The query may find 'John Smith' in the employee table and then the number 6 in the department field. The database will have to go to the department table, look up the row with the number 6 to see that the value is 'Human Resources' and then return those two values, along with any other values that were specified in the select statement, in the query results. Doing this for several rows and for several different kinds of values will take some time.
In a typical data warehouse design, however, all of these values may exist in the same table and be repeated. This way, the query can go to one table and find 'John Smith' and 'Human Resources' without having to translate a foreign key. This keeps things quick.
However, there are some instances in which some normalization is appropriate in a star schema. This normalization is not to the extent that it exists in the source system, which is often third normal form, but it is normalization none the less. Consider the ERD below (click on it to expand)...
This is yet another addition to the star schema that we have been using for the past several weeks. Notice the DIM_EXECUTIVE table at the bottom. It is a dimension table that is joined directly to the DIM_EMPLOYEE dimension table. It is not joined to the fact table. Why would we not add the four non-key values directly to the DIM_EMPLOYEE table? We could and that would not be incorrect, but what if there is not much executive information compared to the number of employees?
So, if the DIM_EXECUTIVE table contains 10 rows and the DIM_EMPLOYEE table contains 4,000,000 rows, then placing this executive information into the DIM_EMPLOYEE table will result in 3,000,990 rows of empty space. In this case, it might make sense.
When a dimension table joins to another dimension table the star schema is now referred to as a snowflake schema. The "second layer" of dimension tables causes the tables, when they are depicted in an ERD, to resemble a snowflake.
I will add that when in doubt, it is probably best not to snowflake. Snowflaking causes some additional complexity on the part of the reporting tools when it comes to interpreting the data.
To experiment with analyzing this kind of data, you can run the script found here in an Oracle environment. Rather than continue adding to the script little by little, this script will create ALL of the tables and data depicted in the ERD. As with last week's post on junk dimensions, you have some options with regards to snowflaking or not. Remember that your number one goal is to turn your organization's data into something that is truly valuable, thus enabling your leaders to make excellent decisions. Make your decision with that in mind.
More on snowflaking can be found in the books listed in the additional reading section to the right as well as by visiting http://www.brianciampa.com/ and, under the Concepts menu, clicking Terms or Advanced.
Update: The Kimball training that I received taught me that I was incorrect in classifying this type of design as a snowflake schema. A snowflake schema contains a completely normalized version of the dimension tables. This post describes an outrigger table. The example above should still be considered a star schema. Sorry for my mistake.
Image(s): FreeDigitalPhotos.net
Subscribe to:
Posts (Atom)







