Extending the Data Warehouse Logical Schema
This section discusses extending the Data Warehouse logical schema. The architecture of the logical schema is governed by the Data Warehouse meta-model. Extending the logical schema requires detailed knowledge of the meta-model. For more information, see Data Warehouse Meta-Model.
Note
The code provided in the following example is for demonstration only. The OrderFormHeader class created in the example already exists in the Data Warehouse schema. The code provided in the following example requires schema change and commit schema commands to stand alone.
Note
Wherever possible, use existing Data Warehouse structures to store data. Deletion from the logical schema is not supported in Commerce Server 2009.
Note
The SQL script csdwschema.sql, found in the root installation directory of Commerce Server 2009, creates the logical schema. This script must be run on an empty database. If the schema must be reinstalled, delete the previous database, create a new database, and rerun the script.
Follow these steps to extend the Data Warehouse.
To extend the Data Warehouse
Connect to the Data Warehouse and turn on the schema change mode. Turning the schema change mode on indicates a schema change session. Changes to the schema are only allowed when in schema change mode. The changes can only modify existing components of the schema. Inserting data is not permitted. When in this mode, provider commands and URLs are available to change the schema. To view the code to complete this step, see Creating a New Class.
Create the classes. For more information about this step, see Creating a New Class.
Populate the classes with the appropriate data members. For more information about this step, see Creating a New Data Member.
If it is needed, explicitly create a key for the class. A class key can be implicitly created for a single member key. For more information about this step, see Creating a New Class Key.
If it is needed, explicitly create key members for the class. For more information about this step, see Creating a New Key Member.
If it is needed, create relations between the classes. If the new structure is to be linked to the existing logical schema, relations have to be created between the new classes and existing Data Warehouse classes. For more information about this step, see Creating a New Class Relation.
If it is needed, create relation members between data members of the classes. For more information about this step, see Creating a New Class Relation Member.
The CommitSchema command persists the session changes to the actual schema tables, if all changes pass validation. You should perform this when all the individual schema change operations have been performed. This commits all pending schema changes to the persistent storage within SQL Server in a single transaction.
A running example is provided to demonstrate these steps by using an existing Data Warehouse class. An existing class is used to provide insight into how the structure fits into the logical schema. The class to be created is the existing OrderFormHeader class. A purchase order consists of the OrderFormHeader class, representing the information that is required by an organization to process the order, and the OrderFormLineItems class detailing the purchases. For simplicity, this example will ignore the detailed line items and concentrate on how to create the OrderFormHeader class and link the OrderFormHeader class to an existing OrderGroup class.
The example does not show error checking or certain other formalities required for functional code.
After this example, how to filter and create summarization tables is discussed.