Sei sulla pagina 1di 6

COMPANY NAME -- PROJECT NAME Example data model information workbook

The Data Warehouse Lifecycle Toolkit

Date: Friday, December 14, 2007


Database: Sample Database
Description: Example data model information workbook

Note: There is a version of this workbook that automatically generates the database and table
create scripts for Microsoft SQL Server 2005, from the information you input in the
spreadsheet. You can download that script from the website associated with The Microsoft
Data Warehouse Toolkit (2005): www.MsftDWToolkit.com.

Data Warehouse Lifecycle Toolkit, 2nd Edition


11/25/2019 Page 1 of 6
Copyright 2008, Kimball Group
COMPANY NAME -- PROJECT NAME Example data model information workbook

Date Change # Person Description


8/30/2005 1 WT Added Change Log tab
8/30/2005 2 WT Removed Region Alternate Hierarchy, added demographics to Customer
12/17/2007 3 JM Removed macros, cleaned up and simplified
A change log is a good idea, once the original data
model is (largely) developed. If you're using source
control, the change log there should be the primary
one. But a simple change log like this, embedded in
the document, is quite useful.

Data Warehouse Lifecycle Toolkit, 2nd Edition


11/25/2019 Page 2 of 6
Copyright 2008, Kimball Group
COMPANY NAME -- PROJECT NAME Customer Example data model information workbook

Data Warehouse Lif


Customer
Table Name Dimension
View Name Customer
Display Name Customer
Description The Customer dimension includes all corporate customers
Used in schemas Orders, Returns, CustomerCare, Shipping

Target Source
Column Name Display Name Description Attribute Group Datatype Size Precision Key? FK To NULL? Default Value SCD Source Source Source Source Field Source ETL Rules Comments
Type System Schema Table Name Datatype

customer_key Customer Key Surrogate primary key Identifiers int PK N


account_number Account Number Account Number from the transaction system Identifiers varchar 10 N POS Sales Customer AccountNumber varchar(10)

customer_type Customer Type The type of the customer based on our Identifiers char 10 N 1 Derived Sales Customer CustomerType Decode CustomerType from S/I to
relationship Reseller/Individual else Unknown

customer_id Customer Id Customer account number and full name (Last, Identifiers varchar 100 N 1 Derived AcctNum + ' ' + DW.FullName
First Middle)
customer_title Customer Title Courtesy title Name and address char 5 N 1 POS Person Contact Title nvarchar(8)

customer_first_name Customer First Name Customer's first name Name and address varchar 30 N 1 POS Person Contact FirstName nvarchar(50)

customer_middle_name Customer Middle Customer's middle name (often blank) Name and address varchar 30 N 1 POS Person Contact MiddleName nvarchar(50) Map NULL to empty string
Name
customer_last_name Customer Last Name Customer's last name Name and address varchar 30 N 1 POS Person Contact LastName nvarchar(50)

customer_full_name Customer Full Name Customer's full name as Last, First Middle Name and address varchar 100 N 1 Derived LastName + ', ' + FirstName + ' ' + MiddleName

birth_date Customer Birth Date Customer's date of birth Demographics datetime 1 POS Sales Individual Demographics xml Shred Demographics: <BirthDate>
customer_email Customer Email Customer's email address Name and address varchar 50 N 1 POS Person Contact EmailAddress nvarchar(50)
income_range IncomeRange Customer's annual Income Demographics varchar 50 N 1 POS Sales Individual Demographics xml Shred Demographics: <YearlyIncome>
total_children TotalChildren Customer's total number of children Demographics tinyint N 1 POS Sales Individual Demographics xml Shred Demographics: <TotalChildren>
education Education Customer's education level Demographics varchar 30 N 1 POS Sales Individual Demographics xml Shred Demographics: <Education>
occupation Occupation Customer's general occupation (eg Managerial) Demographics varchar 30 N 1 POS Sales Individual Demographics xml Shred Demographics: <Occupation>

phone Phone Customer's phone number Name and address varchar 20 N 1 POS Person Contact Phone nvarchar(25)
address_line1 AddressLine1 First line of customer's address Name and address varchar 60 N 1 POS Sales CustomerAd AddressLine1 nvarchar(60) Join from Person.Contact on CustomerID; pick
up the most recent address
address_line2 AddressLine2 2nd line of customer's address (often blank) Name and address varchar 60 N 1 POS Sales CustomerAd AddressLine2 nvarchar(60) see notes for AddrLine1; be sure to map null
entries to empty string
postal_code PostalCode Postal code, eg zip code Name and address varchar 15 N 2 POS Person Address PostalCode nvarchar(15) see notes for AddrLine1
city City City, cleaned up by way of postal code Name and address varchar 100 N 2 Derived nvarchar(30) Out of scope for Phase 1

state State State or Province Name and address varchar 50 N 2 POS Person StateProvinc Name nvarchar(50) Join from Person.Address.StateProvinceId
country Country Country Name and address varchar 50 N 2 POS Person CountryRegi Name nvarchar(50) Join from
Person.StateProvince.CountryRegionCode
current_row_ind Current Row Ind Is this the current row for this member (Y/N)? Housekeeping char 1 N Derived Standard SCD-2

effective_date Effective Date When did this row become valid for this member? Housekeeping datetime N Derived Standard SCD-2

expiration_date Expiration Date When did this row become invalid? (12/31/9999 if Housekeeping datetime N 12/31/9999 Derived Standard SCD-2
current row)

Data Warehouse Lifecycle Toolkit, 2nd Edition


11/25/2019 Page 3 of 6
Copyright 2008, Kimball Group
COMPANY NAME -- PROJECT NAME Orders Example data model information workbook

Table Name Orders


Table Type Fact
View Name Orders
Display Name Orders
Description Orders captures order transactions at the order line item level

Target Source
Column Name Display Name Description Datatype Size Precision Key? FK To NULL? Default Value Example Values Source System Source Source Table Source Field Name Source Extraction/Transformation Rules Comments
Schema Datatype
product_key Product Key Key to Product dimension int FK DimProduct.ProduN 1, 2, 3 Derived Key lookup from SalesOrderDetail.ProductID

customer_key Customer Key Key to Customer dimension int FK DimCustomer.Cus N 1, 2, 3 Derived Key lookup from SalesOrderHeader.CustomerID

order_date_key Order Date Key Key to Date dim for the date the order int FK DimDate.DateKey N 1, 2, 3 Derived Key lookup from SalesOrderHeader.OrderDate
was placed
due_date_key Due Date Key Key to Date dim for the date we expect int FK DimDate.DateKey N 1, 2, 3 Derived Key lookup from SalesOrderHeader.DueDate
the order to be delivered
promotion_key Promotion Key Key to Promotion dimension smallint FK DimPromotion.ProN 1, 2, 3 Derived Key lookup from
SalesOrderDetail.SpecialOfferID
sales_order_num Sales Order Num Sales order number from trxn system int PK N 1, 2, 3 AW Sales SalesOrderHeader SalesOrderID int

sales_order_line_num Sales Order Line Nu Sales order line number int PK N 1, 2, 3 AW Sales SalesOrderHeader RevisionNumber tinyint
sales_order_revision_num Sales Order Revisio Sales order revision number tinyint PK N 1, 2, 3 AW Sales SalesOrderDetail LineNumber tinyint
order_qty Order Qty Quantity of this item in this order smallint AW Sales SalesOrderDetail OrderQty
unit_price Unit Price Standard price for this item money AW
extended_amt Extended Amt Price * Quantity money Derived UnitPriceUSD * OrderQty
unit_price_discount_pct Unit Price Discount Discount % applied to this line item in float AW Sales SalesOrderDetail UnitPriceDiscount money Convert currency to float Though it's a money data type in the source, this is a
this order, if any %
discount_amt Discount Amt Discount in US Dollars money AW SalesOrderDetail UnitPriceDiscount money UnitPriceDiscountPct * ExtendedAmtUSD
product_std_cost Product Std Cost Product's cost of goods sold money DW DimProduct StandardCost
total_product_cost Total Product Cost COGS * Quantity money AW ProductStdCostUSD * OrderQty
sales_amt Sales Amt ExtendedAmt adjusted for discounts money Derived ExtendedAmtUSD - DiscountUSD
(LineTotal from the trxn system)
tax_amt Tax Amt Tax Amount, prorated across items in the money AW SalesOrderDetail TaxAmt Allocate TaxAmt to line item level based on this
order item's $ contribution to the total sale
freight_amt Freight Amt Freight Amount, prorated across items in money AW Allocate Freight to line item level based on this Allocating based on weight would probably be better.
the order item's $ contribution to the total sale
customer_po_num Customer PO Num Purchase Order Number from the varchar 25 AW Sales SalesOrderHeader PurchaseOrderNumber
transaction system

Data Warehouse Lifecycle Toolkit, 2nd Edition


11/25/2019 Page 4 of 6
Copyright 2008, Kimball Group
COMPANY NAME -- PROJECT NAME BlankDim Example data model information workbook
Table Name Table_Name
Table Type Dimension
View Name Table Name
Display Name Table Name
Description Brief description of the Table_Name table
Used in schemas List of schemas using this table

Target Source
Column Name Display Name Description Attribute Group Datatype Size Precision Key? FK To NULL? Default Value Example Values SCD Source SystemSource SchemaSource Table Source Field Name Source ETL Rules Comments
Type Datatype
blank_dim_key Blank Dim Key Surrogate primary key Identifiers int PK 1, 2, 3… Derived
blank_natural_key Natural Key Natural key from source system Identifiers

current_row_ind Current Row Ind Is this the current row for this member (Y/N)? Housekeeping char 1 Y, N Derived Standard SCD-2
effective_date Effective Date When did this row become valid for this member? Housekeeping datetime 3/19/2004 Derived Standard SCD-2

expiration_date Expiration Date When did this row become invalid? (12/31/9999 if Housekeeping datetime 12/31/9999 1/14/1998, Derived Standard SCD-2
current row) 12/31/9999

11/25/2019 Data Warehouse Lifecycle Toolkit, 2nd Edition Page 5 of 6


Copyright 2008, Kimball Group
COMPANY NAME -- PROJECT NAME BlankFact Example data model information workbook
Table Name Table_Name
Table Type Fact
View Name Table Name
Display Name Table Name
Description Brief description of the Table_Name table

Target Source
Column Name Display Name Description Datatype Size Precision Key? FK To NULL? Default Value Example Values Source System Source Source Table Source Field Name Source Extraction/Transformation Rules Comments
Schema Datatype
dim1_key Dim1 Key Key to Dim1 smallint FK BlankDim.BlankDi N 1, 2, 3 ETL Process
dim2_key Dim2 Key Key to Dim2 int FK BlankDim2.BlankD N 1, 2, 3 ETL Process

fact_natural_key Natural Key The natural key for the fact table, if any varchar 20 PK N
(eg order number)

11/25/2019 Data Warehouse Lifecycle Toolkit, 2nd Edition Page 6 of 6


Copyright 2008, Kimball Group

Potrebbero piacerti anche