Group 5 Detailed-Level-Dimensional-Modeling-Workbook-Group5
Group 5 Detailed-Level-Dimensional-Modeling-Workbook-Group5
Group 5 Detailed-Level-Dimensional-Modeling-Workbook-Group5
Date:
Database:
Description:
Version:
Gen FKs?:
Schema for Views:
= Fact
= Dimension
= Utility Table
- The process of generating a script does nothing in your database. It simply generates a script into a new worksheet at the e
- We're not "Real Programmers," so there is not a huge quantity of error checking in the macros, and there are definitely no g
save your workbook before generating the script.
- You can use this workbook and macro to generate an arbitrary SQL Server database. Here are some instructions and rules
o To use this tool, first go to the Home worksheet and enter the overall database information.
o Next, make a copy of the BlankDim or BlankFact worksheet for each dimension or fact table you'd like to create.
o Name each worksheet according to the display name of the table it defines.
o Delete the example entries in each sheet and fill in the table and column names, definitions, etc. for your tables.
o Change the "N" to "Y" in the Generate Script? field if you want the macro to include the table in the script.
o The "Key?" column takes the following values: PK (Primary Key), ID (Identity), FK (Foreign Key). You can combine PK ID to
generated surrogate key for a dimension.
o The "FK To" column holds the table and column reference to the primary key of the table to which this entry is a foreign key
(tablename.columnname).
o The table header rows at the top of each worksheet get instantiated as table-level extended properties.
o Add rows to that area in order to add information that you'd like to be additional table extended properties.
o Leave a blank line before the Column Information section.
o We'll create extended properties for each column starting with DisplayName (until we see an empty cell in that header row)
o The diagram generator looks for the fact tables, then uses the foreign key definitions to find the associated dimension table
o Be sure to fill in the display name for a better looking diagram
o Once you create a diagram, you can click on each table in the diagram and it will link you back to the table's worksheet
(this only works if the worksheet name matches the display name of its table, otherwise, the links are invalid)
The Home sheet in this workbook is for general information and navigation purposes.
erate SQL Script" starts an Excel macro that will
te Diagram(s)" starts an Excel macro that adds a
m of the model.
properties.
ed properties.
16/2/2009 15 3.4 JM
15/1/2009 14 3.4 JM
11/6/2008 13 3.3 WT
20/5/2008 12 3.3 WT
4/4/2008 11 3.2 WT
16/11/2007 10 3.2 WT
10/8/2006 9 WT
7/8/2006 8 WT
25/7/2006 7 WT
25/7/2006 6 WT
13/7/2006 5 WT
18/5/2006 4 JM
11/1/2006 3 JM
30/8/2005 2 WT
30/8/2005 1 WT
Description
Confirmed for SQL2008R2. Fixed many small bugs, including FK generation. Added user-oriented
views that use the display names. Made it prettier.
Changed char and varchar datatypes to nchar / nvarchar almost everywhere. Added a few
transaction IDs that are useful in the ETL process.
Translated to Excel 2007. Translated to SQL 2008. Changed database recovery mode to simple.
Simplified audit dimension.
Added a macro to convert version 3.2 worksheets into version 3.3
Added the ability to specify an optional schema level in the table names and removed spurious
references to the word schema.
Updated bubble diagram generator to include fact table column name in all role playing dims
Removed the SET IDENTITY INSERT commands for tables that do not have an IDENTITY
column
Added code to allow the Audit dimension to be identified as an Audit Table Type rather than a
dimension.
Updated the instructions
Added a Description for the overall database on the Schemas page and set the macro to
overwrite the extended property if the Description already exists.
Added a Display Name field at the attribute level
Added the bubble diagram generator
Oops. Fixed parentheses error that showed up (for whatever reason) in non-US locales.
Fixed FK generation error
Removed Region Alternate Hierarchy, added Sales Region to Customer
Added Change Log tab
Table Name DimAudit
Table Type Audit Home Page
Display Name Audit
Database Schema
Table Description Audit dimension tags each data row with the the process that added or updated it.
Comment The Audit dimension keeps track of each execution branch of your Integration Services packages. By
Biz Filter Logic
Size one row per execution of a package
Generate Script? Y
1, 2, 3…
1, 2, 3…
Y, N
determine which package -- and which branch of each package -- loaded (or updated) data in the data warehouse tables. And, when that p
Target
Comments Datatype Size Precision Key? FK To NULL?
int PK ID N
int FK DimAudit.AuditKey N
nvarchar 50 N
nvarchar 50 N
uniqueidentifier Y
uniqueidentifier Y
smallint Y
smallint Y
datetime N
datetime Y
uniqueidentifier Y
bigint Y
bigint Y
bigint Y
bigint Y
bigint Y
bigint Y
bigint Y
nchar 1 N
arehouse tables. And, when that package was executed.
Source
Default Value Source Source Schema Source Table Source Field Name Source
System Datatype
Derived
Derived
Unknown
Unknown
getdate()
N
Table Name DimCustomer
Table Type Dimension Home Page
Display Name Customer
Database Schema
Table Description Customers Dimensions
Comment comes from customers table in nopCommerce
Biz Filter Logic
Size one for each row
Generate Script? Y
1, 2, 3… key
ALFKI key
[email protected] 2
[email protected] 2
1 2
0 2
Dilli, Syracuse, United States 2
Richa Malhotra 2
Reebok 2
Syracuse 2
13210 2
USA 2
Y, N n/a Exclude from cube Standard SCD-2
24/1/2011 n/a Exclude from cube Standard SCD-2
1/14/1998, 12/31/9999 n/a Exclude from cube Standard SCD-2
int PK ID N
int 5 N
nvarchar 1000
nvarchar 1000
bit N
bit N
nvarchar 1002 N
nvarchar 1000
nvarchar 1000
nvarchar 1000
nvarchar 100
bit N
datetime N
datetime N
nvarchar 200 N
int FK DimAudit.AuditKey N
int FK DimAudit.AuditKey N
Source
Default Value Source System Source Schema Source Table Source Field Name Source
Datatype
Derived
group5-nopCommerce dbo Customer Id int
group5-nopCommerce dbo Customer Username nvarchar
group5-nopCommerce dbo Customer Email nvarchar
group5-nopCommerce dbo Customer Active bit
group5-nopCommerce dbo Customer Deleted bit
Derived
Derived
group5-nopCommerce dbo Address Company nvarchar
group5-nopCommerce dbo Address City nvarchar
group5-nopCommerce dbo Address ZipPostalCode nvarchar
1 Derived
12/31/1899 Derived
31/12/9999 Derived
N/A Derived
Derived
Derived
Table Name DimProduct
Table Type Dimension
Display Name Product
Database Schema
Table Description Product Dimension
Comment comes from product table in nopCommerce
Biz Filter Logic
Size one for each row
Generate Script? N
ProductKey ProductKey
ProductID ProductID
ProductName ProductName
ProductCategory ProductCategory
ProductShortDescription ProductShortDescription
RowIsCurrent Row Is Current
RowStartDate Row Start Date
RowEndDate Row End Date
Comments
This is the template for a dimension table. Use the "Move or Copy Sheet" choice on the Edit menu to make a
of this sheet before you make any changes to it. Be sure to check the "Create a Copy" box in the dialog box.
Usage notes:
- The Key? Column is PK, FK, or PK ID. Make sure you set the NULL? column to N for a PK column.
- Don't re-order the columns, unless you want to mess with the macro.
- The table and column "Comments" fields are not added as extended properties. Extended properties are lim
to 128 characters.
Target
ETL Rules Comments Datatype Size Precision
int
int
nvarchar 400
nvarchar 400
nvarchar 1000
Standard SCD-2 nchar 1
Standard SCD-2 datetime
Standard SCD-2 datetime
PK ID N Derived
N group5-nopCommerce dbo Products
N group5-nopCommerce dbo Products
N group5-nopCommerce dbo Category
N group5-nopCommerce dbo Products
N Derived
N 12/31/1899 Derived
N 31/12/9999 Derived
N N/A Derived
FK DimAudit.AuditKey N Derived
FK DimAudit.AuditKey N Derived
ce
Source Field Name Source
Datatype
ProductID int
ProductName nvarchar
Name nvarchar
ShortDescription nvarchar
Table Name DimStore
Table Type Dimension Home Page
Display Name Product
Database Schema
Table Description Product Dimension
Comment comes from storetable in group5-nopCommerce
Biz Filter Logic
Size one for each row
Generate Script? N
Comments
This is the template for a dimension table. Use the "Move o
of this sheet before you make any changes to it. Be sure to
Usage notes:
- The Key? Column is PK, FK, or PK ID. Make sure you set
- Don't re-order the columns, unless you want to mess with t
- The table and column "Comments" fields are not added as
128 characters.
Example Values SCD Display Folder ETL Rules
Type
1, 2, 3… key
1, 2, 3… key
Grabys 2
1 ,2 ,3… 2
1020 Westcott , 13210 Syracuse, NY 2
3159351147 2
Y, N n/a Exclude from cube Standard SCD-2
24/1/2011 n/a Exclude from cube Standard SCD-2
1/14/1998, 12/31/9999 n/a Exclude from cube Standard SCD-2
a dimension table. Use the "Move or Copy Sheet" choice on the Edit menu to make a copy
make any changes to it. Be sure to check the "Create a Copy" box in the dialog box.
K, FK, or PK ID. Make sure you set the NULL? column to N for a PK column.
mns, unless you want to mess with the macro.
"Comments" fields are not added as extended properties. Extended properties are limited to
Target
Comments Datatype Size Precision Key? FK To NULL?
int PK ID N
int N
nvarchar 400 N
nvarchar 1000 N
nvarchar 1000 N
nvarchar 1000 N
nchar 1 N
datetime N
datetime N
nvarchar 200 N
int FK DimAudit.AuditKey N
int FK DimAudit.AuditKey N
Source
Default Value Source System Source Schema Source Table Source Field Name Source
Datatype
Derived
group5-nopCommerce dbo Store ID int
group5-nopCommerce dbo Store Name nvarchar
group5-nopCommerce dbo Store CompayName nvarchar
group5-nopCommerce dbo Store CompanyAddress nvarchar
group5-nopCommerce dbo Store CompanyPhoneNumber nvarchar
Derived
12/31/1899 Derived
31/12/9999 Derived
N/A Derived
Derived
Derived
Table Name OrderFact
Table Type Fact
Display Name Blank Fact
Database Schema
Table Description Orders Fact Table
Comment
Biz Filter Logic
Size
Generate Script? N
StoreKey StoreKey
ProductKey ProductKey
CustomerKey CustomerKey
OrderID OrderID
OrderItemID OrderItemID
ProductTotalPrice ProductTotalPrice
ProductDiscountPercent ProductDiscountPercent
OrderDateKey OrderDateKey
QuantityOrdered QuantityOrdered
ProductDiscount OrderDiscount
InsertAuditKey InsertAuditKey
UpdateAuditKey UpdateAuditKey
Home Page
key int
key int
key int
int
int
key datetime
int
InsertAuditKey Insert Audit Key Key to Audit dimension for row insertion 1, 2, 3
UpdateAuditKey Update Audit Key Key to Audit dimension for row update 1, 2, 3
AverageProductRating AverageProductRating Always add a description! 4.4
TotalRatings TotalRatings Total number of reviews 10
TotalApprovedRatings TotalApprovedRatings Total Approved reviews 6
TotalDisApprovedRatings TotalDisApprovedRatings Total disapproved reviews 2
TotalHelpfulYesCount TotalHelpfulYesCount Number of customers who found the reviews 8
TotalHelpfulNoCount TotalHelpfulNoCount helpful
Number of customers who did not find the reviews 2
helpful
Display Folder ETL Rules Comments Datatype
key int