Skip to main content

skip to main content

developerWorks  >  Information Management  >

Get started with Informix Warehouse Feature, Part 1: Model your data warehouse using Design Studio

developerWorks
Go to the previous pagePage 7 of 11 Go to the next page

Document options
PDF format - Fits A4 and Letter

PDF - Fits A4 and Letter
1890 KB (56 pages)

Get Adobe® Reader®

Discuss


My developerWorks needs you!

Connect to your technical community


Rate this tutorial

Help us improve this content


Creating physical data model from a template



Let's now create the physical data model for sales_demo from scratch (from an empty template).


  1. Create a new physical data model using the sales_demo database and the specifications from before, except select Create from template this time, then click on Next.


    Figure 29. Template option
    Template option

  2. The next screen provides an option to use an existing template. Go with the default (empty template), and click on Finish.

    Figure 30. Selecting a template
    Selecting a template

    Both data models have been created under the Data Models folder in the Sales Demo – ELT and DW Project. The data diagrams are created under the Data Diagrams folder in the project.



    Figure 31. Location of the data models and data diagrams
    Location of the data models and data diagrams

  3. Notice that the sales_demo.dbm does not have a database specified. It is named Database. Let's change that to sales_demo:
    1. Click on Database under sales_demo.dbm (you might need to double click on sales_demo.dbm to expand the tree).
    2. The Properties window appears on the lower right panel. Change the name "Database" to sales_demo, and select Save.

      Figure 32. Changing the default database name
      Changing the default database name

  4. Do the same for Schema. To do so, expand the database folder (now sales_demo) and change the schema property name.

The expanded tree of the sales_demo physical data model should now look like Figure 33 (notice the Diagrams folder is also expanded):


Figure 33. Expanded tree of sales_demo physical data model
Expanded tree of sales_demo physical data model


Creating new tables for sales_demo

The diagrams are representative of the databases themselves in the form of Entity-Relationship model. In this section, explore the diagrams and learn how to manipulate them. You'll also create new tables for the sales_demo database.

  1. Double-click to open the Diagram1 under the Diagrams folder. You see a blank diagram with the Palette on the right. This palette allows you to drag and drop objects on to the blank canvas to create entities and relationships.

    Figure 34. Blank diagram with palette
    Blank diagram with palette

    Explore the Palette and notice the Data and Geometric Shapes folders. You're going to drag and drop the Table object on to the blank canvas to create a table.

  2. Drag and drop the Table object on to the canvas.

    Figure 35. Drag and drop Table object
    Drag and drop Table object

  3. Let's now make a fact table called sales. To rename the table from Table1 to sales, click on the name and enter sales. Alternatively, you can click on the Table1 table and the properties window will appear on the lower panel where you can rename Table1 to sales.

  4. Add the columns to the sales table. Click on the Columns tab in Properties window, and select the Add Column button (the plus sign icon) to add the columns to the sales table. Add the following columns, as illustrated in Figure 36: customer_code, district_code, time_code, product_code, units_sold, revenue, cost, net_profit. Make sure Not Null is specified for customer_code, district_code, time_code, and product_code. They are primary keys, but leave the Primary Key check box unchecked for all of them because you do not want to worry about referential integrity after the first bulk load for now.

    Figure 36. sales fact table
    sales fact table

  5. Repeat the steps for the dimensional tables: geography (Figure 37), product (Figure 38), customer (Figure 39), and time (Figure 40).

    Figure 37. geography dimensional table
    geography dimensional table



    Figure 38. product dimensional table
    product dimensional table



    Figure 39. customer dimensional table
    customer dimensional table



    Figure 40. time dimensional table
    time dimensional table

Column definitions from Listing 1

Use the script provided in Listing 1 as guidance for the tables and columns definitions in the sales_demo database.


  1. Click on Save. Figure 41 illustrates how the diagram will look:

    Figure 41. Updated sales_demo diagram
    Updated sales_demo diagram

  2. Expand the schema to view the newly created tables.

    Figure 42. New tables under admin schema with the sales table expanded
    New tables under admin schema with the sales table expanded

    You want to update the database in the actual server with the new tables.

  3. Right-click on the schema (in this case, admin), and click on Generate DDL....

    Figure 43. Generate DDL
    Generate DDL

  4. The Generate DDL wizard appears. Use the default option (CREATE statements only), and click on Next.

    Figure 44. Generate DDL wizard screen 1
    Generate DDL wizard screen 1

  5. The second screen asks you which objects should be included in the script. Keep the default, and click on Next.

    Figure 45. Generate DDL wizard screen 2
    Generate DDL wizard screen 2

  6. The next screen allows the DDL to be reviewed. Notice the folder and file name. They can be edited to your preference. This example uses the default name and folder. You want to run this script against the server right away, so check the box next to Run DDL on server, and click on Next.

    Figure 46. Generate DDL wizard screen 3
    Generate DDL wizard screen 3

Warning

Please note that if you want the tables created under the admin schema, you have to be connected as user admin. If you are connected as informix user, it will create tables under the informix schema.


  1. Select the sales_demo database in the next screen, and click on Next.

    Figure 47. Generate DDL wizard screen 4
    Generate DDL wizard screen 4

  2. View the summary screen, and click on Finish.

    Figure 48. Generate DDL wizard screen 5
    Generate DDL wizard screen 5

  3. To make sure the script was run successfully, take a look at the SQL Results view in the lower right panel. It also displays the job status on the right.

    Figure 49. Reviewing the job status
    Reviewing the job status

    This view is useful if the script execution is not successful. You can expand the status and analyze every DDL statement executed. Sometimes it would say the table already existed in the database server.


  4. You can verify if the tables are created by opening a dbaccess session and viewing the database.



    Figure 50. Verifying the tables are created
    Verifying the tables are created

Congratulations!! You have completed this tutorial! Now you have created your new Informix-based warehouse repository, sales_demo, and you are ready to go through the other tutorials in this series to create and deploy the processes needed to populate your data warehouse.



Back to top



Go to the previous pagePage 7 of 11 Go to the next page