NoLic PowerArchitectUserGuide-0.9.13
NoLic PowerArchitectUserGuide-0.9.13
1. Introduction ............................................................................................................ 1
About Power*Architect ........................................................................................ 1
About This Guide ................................................................................................ 1
Power*Architect Licensing and Distribution ............................................................. 1
2. Getting Started ........................................................................................................ 2
About Data Models ............................................................................................. 2
About Data Structure Analysis ............................................................................... 2
Copying and Transforming Data ............................................................................ 3
About Advanced Features ..................................................................................... 3
About System Preferences .................................................................................... 3
Understanding the Power*Architect User Interface .................................................... 4
About the Database Tree .............................................................................. 4
About the Playpen ....................................................................................... 5
Using Power*Architect on Different Operating Systems ..................................... 5
Example - Creating a Data Model .......................................................................... 5
Setting Up Databases ................................................................................... 5
Designing a Database ................................................................................... 6
Forward Engineer ........................................................................................ 7
Comparing Data Models ............................................................................... 8
3. Creating a relational Data Model ................................................................................ 11
Working with Tables ........................................................................................... 11
Creating New Tables ................................................................................... 11
Modifying Tables ........................................................................................ 12
Copying Tables from external documents ........................................................ 12
Working with Columns ........................................................................................ 12
Creating New Columns ................................................................................ 12
Modifying Columns ..................................................................................... 14
Moving Columns ......................................................................................... 16
Copy Columns from external documents ......................................................... 16
Working with Primary Keys .................................................................................. 17
Working with Relationships .................................................................................. 17
About Identifying and Non-Identifying Relationships ......................................... 17
Creating Relationships .................................................................................. 18
Modifying a Relationship .............................................................................. 19
Working with Indices ........................................................................................... 23
Creating an Index ........................................................................................ 23
Modifying an Index ..................................................................................... 26
Deleting an Index ........................................................................................ 26
Working with Diagram Objects in the Playpen ......................................................... 26
Using Undo and Redo .................................................................................. 26
Selecting Multiple Objects in the Playpen ........................................................ 27
Deleting Diagram Objects in the Playpen ......................................................... 27
Rearranging Diagram Objects in the Playpen .................................................... 27
Automatically Arranging Tables in the Playpen ................................................. 27
Straightening Diagram Lines in the Playpen ..................................................... 28
Using the Playpen Zoom Options ................................................................... 28
Finding and Replacing Playpen Objects ........................................................... 28
Printing or Exporting a Data Model Diagram .................................................... 29
4. Creating a multidimensional (OLAP) Data Model .......................................................... 30
Creating a new multidimensional Data Model ........................................................... 30
Adding a Cube ........................................................................................... 30
iv
Power*Architect User Guide
v
Power*Architect User Guide
vi
Chapter 1. Introduction
About Power*Architect
Power*Architect from SQL Power Group is a visual data modeling tool designed for data architects,
DBAs, analysts, designers, and other professionals. Quickly design every aspect of your data model using
diagrams and a hierarchical view of your model structure. Your data model remains platform-independent,
allowing you to maintain a single database schema that works well with multiple database platforms.
Power*Architect is also well-suited to data warehouse and data mart design. You can open multiple
source databases concurrently, then drag and drop objects (such as schemas, tables, and columns) into
Power*Architect's data modeling playpen to create a new model. After fine-tuning the data model in the
playpen, you can forward engineer the data model into new database on platforms such as Oracle, SQL
Server, DB2, PostgreSQL, or MySQL. Power*Architect also creates ETL (Extract, Transform, Load)
procedures you can use with Pentaho's popular open source Kettle ETL tool to populate the new database.
Power*Architect provides you with a variety of tools to view and compare data structures and mappings.
For example, you can compare the structure of any two databases, highlighting the differences and
similarities and generating the required DDL statements to synchronize them. You can also create a
visual mapping report listing the source tables used in your data model, or create an easy-to-read profile
summarizing the data contained in a database.
Whether you're building or maintaining a data model, Power*Architect provides the tools to help you
design your model in a fraction of the time.
The guide assumes you are familiar with basic database operations and terminology (please refer to
Chapter 13, Glossary for a list of some common database terms). If you plan to use Kettle jobs, the guide
assumes you have some knowledge about ETL (Extract, Transform, Load) procedures. If you are looking
for more information about ETL, two books you may want to try are Building the Data Warehouse by
W. H. Inmon and The Data Warehouse Toolkit: The Complete Dimensional Modeling by Ralph Kimball
and Margy Ross.
Power*Architect is distributed to the public under the GNU Public License Version 3. A copy of the license
is available in the section called “Appendix A: GNU GPL Version 3” of this User Guide.
1
Chapter 2. Getting Started
To get started using Power*Architect, begin by reading the section called “Understanding the
Power*Architect User Interface” . This section gives you a quick introduction to the main Power*Architect
areas, the playpen and the database tree. You may then want to work through the hands-on the section
called “Example - Creating a Data Model” . This example shows you how to create a simple data model,
set up a database connection, and forward engineer your model to any database you choose.
Power*Architect contains many features, and you may choose to use some or all of these features
depending on what you are trying to accomplish. Please see the following sections for an overview of
typical activities you would perform with Power*Architect.
1. Create a data model using the playpen. You can do this by creating a data model from scratch, reverse
engineering an existing database, or by using a combination of these two methods.
2. Forward engineer your data model to create the data structure in a new database. To use forward
engineering, you must first set up a database type and connection for the target database.
2
Getting Started
• Compare two data models to view the differences and similarities. Generate and run a SQL script to
update an older database to match a newer data model.
• Create a report listing the source tables used for the tables in your Power*Architect data model.
• Export the source-to-target column mappings between a source database and your Power*Architect data
model.
• Copy data across database platforms to create a verbatim copy of an existing database.
3
Getting Started
• The objects in your data model (tables, columns, keys, indices, etc.).
• Any objects you've obtained through reverse engineering an existing database. You can drag these
objects into the playpen to add them to the data model you're building in Power*Architect. (Large objects
may take some time to load in the playpen.)
You can expand the branches in the tree to view objects and can often right-click an object to perform
actions. The following icons are used in the database tree to identify the object type.
Database
Catalogue
Schema
4
Getting Started
Owner
Table
Column
Primary Key
Exported Key
Imported Key
Index
Unique Index
Your data model can includes tables, columns, indices, and relationships. You can create these objects
in Power*Architect or obtain them by reverse engineering an existing database. For more information on
working in the playpen, see Chapter 3, Creating a relational Data Model .
• On Windows and Linux, CTRL is used as the accelerator key. On Macintosh, CMD is the accelerator
key.
• On Windows and Linux, the Power*Architect menu bar is shown below the Power*Architect title bar.
On Macintosh, the menu bar is shown at the top of the Power*Architect window.
Important: You must create the target database needed in this example. You can use standard vendor-
specific database tools to create the database.
Setting Up Databases
1. Setup Driver. Select File->User Preferences if you are using Windows and Architect->Preferences if
you are using Macintosh. Then select the JDBC Drivers tab. Select the database connection type you
5
Getting Started
wish to use from the list on the left. If there is already a driver for the connection type you wish to use,
click OK and go on to the next step. Otherwise, click the Add JAR button, navigate to where you have
the driver Jar file installed, and click OK.
2. Create a Connection. In the Database Tree section of the main window, right click and choose Add
Source Connection->New Connection. For this example you can use a name like SampleDB for the
Connection Name. Then select a data type you wish to use, which should be the driver you set before.
Then fill the hostname, port, database, file if asked. The JDBC URL will automatically generate when
you fill those blanks, so you don't have to type it an extra time. Fill in the Username and password
(which is set on the server machine).
Designing a Database
You are now ready to design some tables. For this example, we will create the Customer and Orders table
shown here.
1. Click the New Table icon at the right side. The cursor will change to a crosshair. Move the cursor near
the left of the Playpen area, and click. A "New Table" will appear.
2. Also, the Table Properties Dialog will appear. Rename this table to Customers.
3. Click the Insert Column icon, and a column property window will appear for the new column. Rename
the column to customer_id and make it part of the primary key.
4. Insert additional columns for Firstname, Lastname, Address, City, Province, Country Code 1 and Postal
Code. The table should look something like the following:
6. Create columns named order_id (in the primary key), Quantity, Total Amount, and customer_id. Your
project should now look something like the following:
6
Getting Started
7. We need a relationship between these tables. An order should have a foreign key that refers to the
customer. Click the "New Non-Identifying Relationship" icon. Select the Customers table, then the
Orders table, and a link will be drawn as shown. Click this link and the keys that take part in the
relationship will be highlighted in red.
Forward Engineer
1. If you're happy with the database layout (you can always change it later), it's time to create the database.
Click on the Forward Engineer button. You should see a window similar to the following:
2. Set the "Create in" database to be the source connection we defined earlier. Set the database type to be
the type that was set in the user preferences. Fill in the remaining fields based on the database type that
was selected and press ok. You should see a window similar to:
7
Getting Started
3. If this looks plausible, click Execute, and the tables and their relationship will be created.
Congratulations! You have now created a simple database using the visual tools in Power*Architect.
2. Click the Insert Column field and, as before, rename the New Column, this time to Shipping_Amount.
Change its type to Decimal with precision 10 and scale 2.
8
Getting Started
3. Now we need to compare two different Data Models, the original database and the current project. Click
the Compare DM icon. Set the "Older" to Physical Database SampleDB (you may need to change the
Schema to Public). Set the "Newer" to "Current Project" (since it is now newer than the database you
created in Step 6). Set the output format to SQL.
PS: swap button can help you easily swap the newer the the older.
4. Click Start. You should see the SQL Preview window again, but this time with just an ADD for the
column you just added:
5. Click Execute, and the new column will be added to your database table.
9
Getting Started
When you exit the program, it will ask to save your project. Since you might want to alter this in future,
to experiment with some of the other tools without damaging any live data, you may wish to save the
Project file.
The remainder of this document provides a more comprehensive explanation of the various functions that
Power*Architect offers.
10
Chapter 3. Creating a relational Data
Model
Use the Power*Architect playpen to create a data model diagram that includes tables, columns, indices,
and relationships. Before you begin, be sure to read Chapter 2, Getting Started , which explains how to
use the playpen and the database tree.
When you create a data model in Power*Architect, the model is saved in its own project. The project
contains the data model diagram in the playpen and the database tree. You can have multiple projects (and
therefore multiple data models) open in Power*Architect at once. Each project opens in a separate window.
1.
Click in the side toolbar. The cursor changes to a +.
Alternate methods:
2. Click in the playpen where you want to create the table. The Table Properties dialog box appears.
11
Creating a relational Data Model
4. Click OK.
Modifying Tables
To modify a table:
•
Click a table in the playpen, then click in the side toolbar.
Alternate methods:
• Modify the table properties as required. For a description of the properties, see the section called
“Creating New Tables” .
• Click OK.
12
Creating a relational Data Model
1. Click a table in the playpen. The location you click determines where the column will be inserted in
the table.
• If you click the table name or if the table does not contain any columns, the new column is added
to the end of the column list.
• If you click an existing column, the new column is added above the selected column.
2.
Click in the side toolbar. The Column Properties dialog box appears.
Alternate methods:
13
Creating a relational Data Model
4. Click OK.
Modifying Columns
To modify a column:
1.
Click a column, then click in the side toolbar.
Alternate methods:
14
Creating a relational Data Model
If you added this column to your data model using reverse engineering, the source database and table
from which the column originated are shown at the top of the Column Properties dialog box.
2. For modifying multiple columns at a same time: select multiple columns, then open column properties
as above. The window looked like this:
15
Creating a relational Data Model
You can modify the properties of every column you selected by checking the checkboxes in front of
them.
3. Modify the column properties as required. For a description of the properties, see the section called
“Creating New Columns” .
4. Click OK.
Moving Columns
You can move a column from one table to another or rearrange columns within a table.
• To move multiple columns, use CTRL+click to select the columns, then drag them to a new location.
Note: You can also add or remove columns from the primary key. For more information, see the section
called “Working with Primary Keys” .
You can also use cut and paste to move to a column from one table to another. The column keeps the
source for ETL mapping from the original table.
16
Creating a relational Data Model
2. Select the table in the Playpen you want to add the column to
2. Drag the column(s) from the primary key area to the table's column list.
Note: You can change the primary key name for the table. For more information, see the section called
“Modifying Tables” .
• In an identifying relationship, the child table cannot be uniquely identified without the parent.
You could choose to create the invoice and invoice line relationship from the previous example as either
an identifying or non-identifying relationship.
• If you create an identifying relationship, an invoice line cannot be uniquely identified without also
knowing the invoice number it belongs to. For example, assume that invoice line numbers always start
at 0 or 1 within each invoice. The same line numbers will appear in different invoices - each invoice
will have a line 0, line 1, line 2, etc.
17
Creating a relational Data Model
• If you create a non-identifying relationship, an invoice can be uniquely identified without knowing
the invoice number it belongs to. For example, assume each invoice line has its own unique identifier
(invoice_line_id). In this example, invoice_line_id is referred to as a "surrogate key," because it's just
a made-up number which has no special meaning in terms of the invoice line.
For this relationship, you would also want to create a unique index on the combination of
(invoice_number, line_number) to guarantee there are no two line items with the same line number on
the same invoice. In the identifying relationship example, the primary key enforces this rule.
Creating Relationships
To create a new relationship:
•
To define an identifying relationship, click in the side toolbar, or press R. The cursor changes
to a +.
•
To define a non-identifying relationship, click in the side toolbar, or press SHIFT+R. The cursor
changes to a +.
Note: To cancel creating a relationship, press ESC or click a blank area in the playpen.
2. Click the parent table, then click the child table. A relationship is created between the two tables and
is shown as a line.
The mapping between the tables is based on the parent table's primary key. For each column in the
primary key of the parent table:
• If the child table contains a column with the same name and this is the first relationship between the
two tables, the relationship is mapped to the existing column in the child table.
18
Creating a relational Data Model
• If the child table does not contain a column with the same name, or the child table contains a column
that has the same name but the column has a different data type, or a relationship already exists
between the tables, a new column is created in the child table. The relationship is mapped to the
new column.
3. To view the columns that are mapped by the relationship, click the relationship link. The mapped
columns are shown in red.
You can now define the relationship properties, view the individual column mappings or change the
mapping of the child table to the parent table. For more information, see the section called “Modifying
a Relationship” .
Note: You can automatically straighten the relationship lines between tables. For more information, see
the section called “Straightening Diagram Lines in the Playpen” .
Modifying a Relationship
To modify a relationship:
1.
Click a relationship link in the playpen, then click in the side toolbar. The Relationship Properties
dialog box appears.
Alternate method:
19
Creating a relational Data Model
20
Creating a relational Data Model
Important Notes:
21
Creating a relational Data Model
3. On the Mappings tab, you can change the mapping to the child table. Click and drag the relationship
link to the column in the child table that is mapped to the parent table.
Note: If a column in the child table has [FK] beside it, this means the column is a foreign key in another
parent table. This alerts you that the column is already "in use", since you wouldn't normally use the
same column as a foreign key in multiple tables.
22
Creating a relational Data Model
4. Click OK.
To create an index:
1.
Select a table in the playpen, then click in the side toolbar. The Index Properties dialog box appears.
23
Creating a relational Data Model
Alternate methods:
24
Creating a relational Data Model
Notes:
25
Creating a relational Data Model
3. Click OK.
Modifying an Index
To modify an index:
1. Right-click a table in the playpen, then click Index Properties. If there are multiple indices for the table,
select the index you want to modify.
Alternate method:
• Right-click the index in the database tree, then click Index Properties.
2. Modify the index properties as required. For a description of the properties, see the section called
“Creating an Index” .
3. Click OK.
Deleting an Index
Right-click the index in the database tree, then click Delete Selected.
If you undo an action accidentally, you can choose to redo the action. However, be careful: If you make
a new change after undoing one or more actions, your redo history is lost.
26
Creating a relational Data Model
To undo an action, click in the top toolbar. You can also select Edit » Undo or press CTRL+Z.
To redo an action, click in the top toolbar. You can also select Edit » Redo or press CTRL+Y.
• Click a blank area in the playpen, then drag to form a grey box around the objects.
Alternate methods:
Notes:
• You can rearrange columns within a table or move columns from one table to another. For more
information, see the section called “Moving Columns” .
• You can automatically arrange the tables in the playpen. For more information, see the section called
“Automatically Arranging Tables in the Playpen” .
• You can automatically straighten the relationship lines between tables. For more information, see the
section called “Straightening Diagram Lines in the Playpen” .
To move a table, select one or more tables, then drag the table(s) to a new location in the playpen.
To move the placement of a relationship link, select a relationship link, then drag either end of the link
to a new location on the parent or child table.
27
Creating a relational Data Model
To automatically arrange tables, select several tables in the playpen, then click in the top toolbar.
Note: If you don't select any tables or select only one table, all of the tables will be arranged.
To straighten the relationship lines, right-click a blank area in the playpen, then click Straighten Lines.
•
Zoom in
•
Zoom out
•
Reset the zoom to the default level
•
Zoom to fit
To use the zoom options on specific objects in the playpen, select the objects before clicking a zoom
button. If you don't select any objects in the playpen, the zoom options affect the entire diagram.
1. Select Edit » Find/Replace, or press CTRL+F. The Find dialog box appears.
28
Creating a relational Data Model
2. Enter your search criteria, then click Search. The Search Results dialog box appears with your results.
3. To rename an object, select the object and click Rename Selected. You can also select multiple objects
if you want to rename all the objects using the same name.
4. To select an object in the playpen, select the object and click Show in Playpen.
You can also find tables in a model by selecting the table in the Playpen Database in the Database Tree
and clicking on 'Zoom to fit' in the Playpen Zoom tools on the right side.
1. Select File » Export Playpen to PDF. The Save dialog box appears.
2. Select the location and filename for the PDF, then click Save.
29
Chapter 4. Creating a multidimensional
(OLAP) Data Model
Using the Power*Architect OLAP Schema Editor you can also create a multidimensional data model that
includes dimensions, cubes and measures.
The development of the OLAP Schema Editor is still in an early stage so not all it's functionality is
implemented yet. We welcome you to try it out and give us your feedback. This part of the manual covers
only a small part of the functionality and is intended for users with experiences in building Mondrian
OLAP schemas.
Now you can easily add cubes, measures and dimensions to your schema by clicking on the according
icon on the right side. The cursor will change to a crosshair. Move the cursor near the left of the Playpen
area, and click. The properties box will appear.
Adding a Cube
To add a cube:
1.
Click on to create a new cube. You can also press "c" instead.
2. The cursor will change to a crosshair. Move the cursor near the left of the Playpen area, and click. The
Cube Properties box will appear.
30
Creating a multidimensional
(OLAP) Data Model
4. Click on OK.
Adding a Dimension
To add a shared dimension:
1.
Click on to create a new dimension.
2. The cursor will change to a crosshair. Move the cursor near the left of the Playpen area, and click.
Adding a Measure
To add a measure:
2.
Click on to add a measure to the cube.
31
Creating a multidimensional
(OLAP) Data Model
Adding a Role
The creation and editing of roles is not supported yet.
32
Chapter 5. Setting up Database
Support
There are many features within Power*Architect that involve connecting to a database, such as reverse and
forward engineering. Power*Architect allows you to use any JDBC- or ODBC-accessible source database.
For more information on supported databases, see the section called “Supported Database” .
1. Define general settings and drivers for the database platform you plan to connect to (such as SQL Server
or Oracle). For more information, see the section called “Setting up Database Types” .
2. Create a connection to a specific database server. This connection uses the general settings and drivers
you have configured for the database platform. For more information, see the section called “Setting
up Database Connections” .
Supported Database
Power*Architect provides full or partial support for the following database platforms.
Note: Remember, at this point you are configuring general settings only and are not connecting to a specific
database. For more information on connecting to a database, see the section called “Setting up Database
Connections” .
• General settings for several database platforms are already pre-configured in Power*Architect. If you
plan to work with one of these database platforms, all you need to do is define the location of the JDBC
driver. For more information, see the section called “Defining the JDBC Driver” .
33
Setting up Database Support
• You can also define additional database platforms in Power*Architect. For more information, see the
section called “Adding a New Database Type” .
Alternate method:
The User Preferences dialog box appears, with the JDBC Drivers tab open. Existing database types,
including the pre-defined database types included with Power*Architect, are listed on the left.
Note: You can modify an existing database type by clicking on it in the list.
34
Setting up Database Support
jdbc:sqlserver://<Hostname>:<Port:1433>
35
Setting up Database Support
4. The settings on the Kettle tab are only used when you create a Kettle job. For more information on
these settings, see the section called “Using Kettle Jobs” .
5. Click OK.
Next, you must define the location of the JDBC driver for the database type. For more information, see
the section called “Defining the JDBC Driver” .
Note: Remember, at this point you are just telling Power*Architect where the drivers are. You must set
up a database connection in order to connect to a specific database server (for more information, see the
section called “Setting up Database Connections” ).
Unlike most applications, which need a distinct driver program to communicate with each type of database,
Power*Architect uses Java-based drivers. These drivers normally come from the database vendor in the
form of JAR (Java Archive) files. JAR files are an extension to the file format used by PKZip/WinZip
archives.
36
Setting up Database Support
Most database platforms provide drivers that are fully backward compatible. This means that it is best
to use the newest driver available, regardless of the software version on the specific database server you
intend to connect to. One exception to this is the Oracle database. It is important to match the major version
number of your JDBC driver with the major version number of the Oracle database server you connect to.
For example, if you are connecting to an Oracle 10g database, use the latest Oracle 10g driver. If you are
connecting to an Oracle 9i database, use the Oracle 9i driver.
1. If you do not have the JDBC driver for a specific database platform, you can usually obtain one
from the database vendor. If that fails, you can find a directory of databases drivers on Sun's
web site [http://developers.sun.com/product/jdbc/drivers] . There is also a permanent thread in the
Power*Architect user support forum [http://www.sqlpower.ca/forum/posts/list/401.page] , where you
can share information with other Power*Architect users about finding and configuring drivers for a
particular database platform.
2. Decide on a permanent location to store your JDBC drivers. A good strategy is to create a JDBC folder
under your Documents folder and collect all of you JDBC driver files there.
3. Save the JDBC driver (it will usually be one or more JAR files) in the location you've chosen.
4. If the User Preferences dialog box is not already open, select File » User Preferences.
7. Locate the JAR file and click Open. If there is a valid driver class in the JAR file, a file tree will appear
showing the JDBC driver classes within the JAR file.
9. Click OK.
Before creating a connection, you must define the general settings for the database platform. For more
information, see the section called “Setting up Database Types” .
Alternate methods:
• Select Connections » Database Connection Manager (or Window » Database Connection Manager),
then click New.
• Right-click a blank space in the database tree, then click Add Source Connection » New Connection.
37
Setting up Database Support
38
Setting up Database Support
3. The settings on the Kettle tab are only used when you create a Kettle job. For more information on
these settings, see the section called “Using Kettle Jobs” .
4. Click OK. The new connection is added to the current project (you can view the connection in the
database tree) and is also added to the Database Connection Manager.
Note: You can permanently delete connections. For more information, see the section called “Modifying
or Deleting Database Connections” .
• Right-click a blank space in the database tree, click Add Source Connection, then select a database
connection.
• Right-click a database connection in the database tree, then click Remove Connection.
• Click a database connection in the database tree, then select Connections » Remove Connection.
Note: You can also remove a connection from a project without permanently deleting the connection. For
more information, see the section called “Adding or Removing Database Connections for a Project” .
1. Select Connections » Database Connection Manager (or Window » Database Connection Manager).
Alternate methods:
• Right-click a database connection in the database tree, then click Connection Properties.
• Select a database connection in the database tree, then select Connections » Connection Properties.
3. Modify the connection settings. For information on the settings, see the section called “Creating a New
Database Connection” .
4. Click OK.
39
Setting up Database Support
1. Select Connections » Database Connection Manager (or Window » Database Connection Manager).
40
Chapter 6. Setting Preferences
Defining Project Settings
You can define several settings that apply to all Power*Architect projects.
1. Select File » Project Settings. The Project Settings dialog box appears.
Snapshot Entire Source Database in Project File? When you open a source database in
Power*Architect (for example, to use for
reverse engineering), the database's data structure
(catalogues, schemas, tables, etc.) is shown in the
database tree. Select this check box if you always
want to save the entire data structure in your
Power*Architect project. This allows you to view
the objects at any time without having to reconnect
to the source system.
41
Setting Preferences
Draw Relationships With Select the method used to draw relationship lines
in the playpen.
42
Setting Preferences
3. Click OK.
Note: This section describes general user preferences and default column settings only. For information on
JDBC drivers preferences, see Chapter 5, Setting up Database Support . You can also set project settings
(see the section called “Defining Project Settings” ).
PL.INI File Enter the location for the pl.ini file. This file
stores the settings for the database connections you
create. If you leave this location blank, you will be
prompted to use a default location when you start
Power*Architect.
3. Click OK.
44
Chapter 7. Reverse Engineering a Data
Model
You can use reverse engineering to obtain a data model from an existing database, then work with the data
model in Power*Architect. You can also use Power*Architect to create an upgrade script for the original
database (for more information, see the section called “Comparing Data Models” ).
You can also use reverse engineering for data warehouse design, where your objective is to unify several
data models and then import the data from the multiple source systems. To do this, you would typically
reverse engineer one table at a time from several different source systems, then make modifications in
Power*Architect, using the playpen. You can then forward engineer the new data warehouse data model
to a new, separate database (for more information, see Chapter 8, Forward Engineering a Data Model ,
then use an ETL tool to transfer the data from the source systems to the data warehouse.
For more information, on ETL tools in Power*Architect, see the following sections:
2. If necessary, create a connection for the database you want to reverse engineer. For more information,
see Chapter 5, Setting up Database Support .
3. Add the database connection to your project. For more information, see the section called “Setting up
Database Connections” .
A database node is added to the database tree. Expand this node to view the hierarchy of objects in the
database (such as catalogues and schemas, tables, columns, indices, and relationships). The hierarchy
is presented the same way a native database tool for the source database platform would present the
hierarchy.
As you click objects in the database tree, the object changes from grey to black to indicate you've
viewed it. All viewed items are saved with the project so you can view them later without having to
reconnect to the source system.
Note: If you want to save the entire hierarchy in the project, enable the snapshot option in project
settings. For more information, see the section called “Defining Project Settings” .
4. You can now create a new data model using the objects from the database tree. Simply drag objects
from the tree into the playpen.
If you drag higher-level containers (such as a schema, catalogue, or the entire database), individual
tables, or multiple tables, all items within the container will be added to the playpen. For example, if
you drag a table into the playpen, all of the columns within the table will be added as well. You can
also drag individual or multiple columns from the database tree into tables in the playpen. Just drag the
columns to the position within the table where you want to insert them.
45
Reverse Engineering a Data Model
In addition to using objects from the database tree, you can create new objects (tables, columns, etc.) in the
playpen. For more information on working with the playpen, see Chapter 3, Creating a relational Data
Model .
• Create a report listing the source tables used for the tables in the playpen. For more information, see the
section called “Creating a Visual Mapping Report” .
• Compare your current data model to the original database. For more information, see the section called
“Comparing Data Models” .
• Forward engineer the schema. For more information, see Chapter 8, Forward Engineering a Data Model
.
• Use a Kettle job to move data from the original database to your new database. For more information,
see the section called “Using Kettle Jobs” .
46
Chapter 8. Forward Engineering a Data
Model
A key design principle of Power*Architect is that the data models you create always remain generic. This
allows you to use the same data model with a variety of database platforms. You can then use forward
engineering to transform a data model for a specific database platform.
When you forward engineer a data model, Power*Architect creates a physical model that represents the
idealized generic model as closely as possible, given the constraints of the target system. Power*Architect
then creates a SQL Script that you can run to place the components of the data model into a database.
It is important to note that Power*Architect creates the structure of the target database only and does not
create the actual database. Before using forward engineering, you must create the target database. You
would typically do this using the administrative tools provided for the database platform.
Note: You can view or change the location of the forward engineering log file in user preferences. For
more information, see the section called “Defining Project Settings” .
1. Open the Power*Architect project containing the data model you want to use. Ensure that all of the
data model elements you want to forward engineer are included in the diagram in the playpen. Make
any required changes, such as:
• Merging two or more tables together. (If the tables you merge have a parent-child relationship, this
is called denormalizing the data model.)
• Splitting a table into several related tables (this is often called normalization).
2. Create the target database. You would typically do this using the administrative tools provided for the
database platform.
3. If necessary, create a connection for the target database. For more information, see Chapter 5, Setting
up Database Support .
4. Add the database connection to your project. For more information, see the section called “Adding or
Removing Database Connections for a Project” .
5.
Click on the top toolbar, or select Tools » Forward Engineering. The Forward Engineer SQL Script
dialog box appears.
47
Forward Engineering a Data Model
7. Click OK. Power*Architect generates a SQL script to create the data structure currently in the playpen.
Note: As Power*Architect is generating the script, warnings or error reports may appear.
48
Forward Engineering a Data Model
9. To run the script, click Execute. The database objects are created in the target database.
49
Chapter 9. Analyzing Data Structures
Comparing Data Models
You can compare two data models to view the differences and similarities. You can compare a database
to a Power*Architect project or to another database.
The data model comparison provides you with a description of the two data models, highlighting their
differences and similarities, which you can copy into a document or save to a text file. You can also use
the data model comparison to generate and run a SQL script that will update the older database to match
the newer data model.
1.
Click on the top toolbar, or select Tools » Compare DM. The Compare Data Models dialog box
appears.
2. In the Compare Older and With Newer sections, select the data models you want to compare.
• Select Current Project - Include an open Power*Architect project in the comparison. The data model
currently in the playpen will be used.
• Physical Database - Include an existing database in the comparison. You must also select the
connection Power*Architect will use to connect to the database. For more information, see the section
called “Setting up Database Connections” .
• From File - Include an existing Power*Architect project in the comparison. Click Choose and select
the project.
Note: If you want to switch the items you've selected in the Compare Older and With New sections,
click Swap.
50
Analyzing Data Structures
3. In the Output Format area, select whether you want to create a SQL script or an English comparison.
4. Select the Suppress similarities check box if you want to include only the differences in the output.
Note: The Start button is only available if both data models in the comparison are valid.
See the following sections for details on the information shown in the data comparison.
The comparison includes descriptions to make the older data model the same as the newer data model.
The components are also colour coded to indicate similarities and differences.
The following table summarizes the meaning of the colour codes used in the data model comparison:
Colour Description
Black The component exists in both data models.
Green The component exists in this data model only.
Red The component does not exist in this data model but
does exist in the other data model.
Blue The component is a column and is on different keys
in the two data models.
To run the script and apply the changes to the older database, click Execute.
Note: The Execute button is only available if the older database has a valid database connection. For more
information, see the section called “Setting up Database Connections” .
Profiling Data
Profiling allows you to view a summary of the data in a database. You can use profiles to quickly learn
the characteristics of data in an unfamiliar database. You can also use profiles for activities such as
database optimization and data migration. When you create a profile, the results are saved as part of the
Power*Architect project.
Note: Power*Architect contains two different menu items related to profiling. Use Profile » Profile only
when you want to create a new profile. If you want to view existing profiles, use Window » Profile
Manager. (The profile manager window is similar to the download manager window in a web browser.)
51
Analyzing Data Structures
2. In the Profile Creator Mode list, select one of the following options:
• Remote Database - This mode sends a query to the database and the database calculates all of the
statistics. This system works well over a large network because very little data is transferred.
Warning: Profiling moderate-to-large tables (for example, with over 250,000 rows) remotely will put
a significant demand on the database server's resources and may impact the database performance
for other users.
• Local Reservoir - This mode transfers all of the data to the local computer and then samples and
processes the data there. This works well over a fast network. This option is still experimental and
may cause an out of memory error when profiling large tables.
3. Click OK.
Creating a Profile
To create a profile:
1. Connect to the database you want to profile. For more information, see the section called “Setting up
Database Connections” .
2. In the database tree, select the tables you want to profile. (You can also select a column. If you do, a
profile will be created for the entire table.)
3.
Click in the top toolbar.
Alternate methods:
• Select the tables you want to profile, then select Profile » Profile.
The Table Profiles window opens. The new profile is listed in the window, along with previous profiles
you've created for the project.
52
Analyzing Data Structures
4. You can view details about each profile in the Table Profiles window. For more information, see the
section called “Viewing Profile Details” .
Note: To create a new profile of the same table, select the table in the Table Profiles window and click
. The previous profile will be retained as well. (Power*Architect will connect to the source database
to create the new profile, regardless of the profile mode you're using.)
1. If the Table Profiles window is not already open, select Window » Profile Manager.
2. You can use the Search box and Order by options to find a profile.
4. To view details for some profiles only, select one or more profiles in the window, then click View
Selected.
You can view the profile details as a graph or table. For more information, see the section called “Using
Profile Graph View” and the section called “Using Profile Table View” .
53
Analyzing Data Structures
The column statistics are shown in the centre of the window. The most common values and their
frequency within the table are also shown.
The pie chart on the right side of the window shows the frequency of the most common values in the
column.
Note: You can set the number of common values to include in the comparison. For more information,
see the section called “Defining Project Settings” .
• To save the profile results in CSV, PDF or HTML format, click Save.
2. To narrow the results, use the Search box in the top-right corner.
4. In the Most Frequent column, hover over a cell to view the value and frequency of the most common
items in the column.
54
Analyzing Data Structures
5. To save the profile results in CSV, PDF or HTML format, click Save.
Deleting Profiles
To delete a profile:
1. If the Table Profiles window is not already open, select Window » Profile Manager.
2.
To delete a profile, click beside the profile or press delete.
3. To delete multiple profiles, use CTRL to select all the profiles you want to delete, then press delete.
1. Create one or more profiles (see the section called “Creating a Profile” ).
3. In the Table Profiles window, select the profiles you want to include in the PDF, then click View
Selected (see the section called “Viewing Profile Details” ). Or click View All to include all of the
profiles in the PDF.
4. Click Save.
5. Select PDF as the file type and enter a filename, then click Save.
1. Open the project containing the data model you want to use.
3. Select the location and filename for the CSV file, then click Save.
55
Chapter 10. Copying and Transforming
Data
Copying Data Across Database Platforms
You can use Power*Architect to quickly copy data from one database platform (such as Oracle) and create a
verbatim copy on another database platform (such as PostgreSQL). Power*Architect automatically checks
for foreign key constraints in the target database and orders the inserts and deletes accordingly.
You can also use Power*Architect to copy data if the source and target databases are on the same database
platform. However, in this case, it's usually faster and more reliable to use the database vendor's own tools
to do a "dump-and-restore".
If you want to do something more complex than a verbatim copy, use an ETL tool such as Kettle. ETL
tools offer great flexibility in extracting, transforming, and loading data between databases. For more
information, see the section called “Using Kettle Jobs” .
To copy data:
1. Select Tools » Copy Table Data. The Copy table data dialog box appears.
2. Select the Source and Destination databases. If necessary, click Database Connection Manager to set
up a new database connection.
3. Select the Truncate Destination Table check box to delete all existing data in the destination tables
before copying the data from the source tables.
56
Copying and Transforming Data
Warning: Only use this option if you are sure you want to delete the existing data in the destination
tables.
4. Click OK.
Note: The Kettle ETL tool is provided by Pentaho as free and open source software. SQL Power does not
maintain or distribute Kettle. To obtain a copy, visit kettle.pentaho.org [http://kettle.pentaho.org/] .
1. Create a new data model in Power*Architect using reverse engineering (see Chapter 7, Reverse
Engineering a Data Model ).
2. Forward engineer the data model into a new database (see Chapter 8, Forward Engineering a Data
Model ). This creates the tables and relationships in the target database.
Note: You can view or change the location of the Kettle (ETL) log file in user preferences. For more
information, see the section called “Setting User Preferences” .
1. Open the project containing the data model you want to use for the Kettle job.
2. Select ETL » Create Kettle Job. The Create a Kettle Job dialog box appears.
57
Copying and Transforming Data
58
Copying and Transforming Data
Save Job to File Select this option to save the Kettle job settings and
transformations to a file. Click Browse and select
the location and filename.
Save Job to Repository Select this option to save the Kettle job settings and
transformations in a repository.
If you are using a repository, you are prompted to select the directory location in the repository where
the files will be saved.
Once the job has been created, a window appears with the steps you need to complete before running the
Kettle job.
Note: The transformation files are stored in the same location as the Kettle job. You must use Kettle to
run the job.
59
Chapter 11. Universal SQL Access
Universal SQL Access is a "fall-back" tool that lets you work at the raw SQL command level. This is an
advanced topic and should only be used by those familiar with the intricacies of SQL commands and the
details of your database.
Universal SQL Access is started from the menu entry under the Tools menu, and begins with the GUI
window shown below. The first thing you should do is select which database connection you wish to use.
The list of Connections is the same as the main program uses, as set up in the JDBC Connections window.
The basic steps to using Universal SQL Access are to type a command in the top (SQL Command) section
of the window and click the Execute button; the results are displayed in the bottom (SQL Results) section.
To save you some typing, you can just drag the databases, tables and columns shown in the DB tree at the
left of the Universal SQL Access window and drop them on the top (SQL Command) section.
You can enter more than one SQL statement in the SQL Command section. If you do this, be sure to
terminate each one with a semicolon. If you enter only one SQL statement, the terminating semicolon is
unnecessary. The statements are not interpreted by Universal SQL Access itself, so anything that the given
database and driver accepts can be used. For example, with Oracle, you can use PL/SQL statements. With
most drivers you should be able to use stored procedures.
To execute your commands, use the mouse to press the execute button, or hit Ctrl-Enter (Command-Enter
on Mac). Normally, all statements in the SQL Command text area will be executed in sequence. However,
if there is a selection (in other words, some of the text is highlighted) when you execute, only the selected
text will be executed. So if you only want to execute a subset of the commands, simply select the part
you wish to execute.
By default, auto-commit is enabled, which means each SQL statement is executed in its own transaction
context. Be careful, because this means the effects of your update and delete statements are not undoable!
If you turn the Auto Commit off, and your database supports transactions (most do), you can manually
Commit or Rollback later.
60
Universal SQL Access
Universal SQL Access keeps a log of statements executed and errors encountered. If you run an undate-type
statement, or your statement is rejected by the database, the bottom half of the window will automatically
switch to the "Log" tab so you can see the row count or database error message, respectively. Conversely,
when you execute a select-type statement, the bottom half of the window switches to the tabular result set
view so you can see the data that was selected. Note that in this case, there will still be an entry in the log
tab with the date and time the query was executed, how long it took to execute, and how many rows were
selected. You can see this information by manually switching to the "Log" tab.
Output Formats
The output format in the result window is always Table mode, which provides a friendlier interface which
ensures all of the columns are lined up properly. If you right-click on a table or multiple tables, you can
save the results to a file in HTML or CSV format. The HTML format consists of a table containing results
of the select statement. The CSV format, produces a comma-separated values file with a header row, which
is suitable for importing to any spreadsheet program, such as Microsoft Excel or OpenOffice Calc.
CSV files are often used as a simple way to transfer a large volume of spreadsheet or database information
between programs, without worrying about special file types. For example, transferring a home-made
address book from Power*Architect into a database program such as Filemaker Pro could be done by
exporting the file as a CSV from Excel, then importing that CSV into Filemaker.
For example, here are the results of executing the select statement, "select * from art_logs":
You can view this same data in HTML by right-clicking the selected table, then choosing "Exported
selected to HTML..". Here is what the generated HTML looks like in a text editor:
61
Universal SQL Access
With the addition of a custom CSS style sheet, this HTML page could fill a basic reporting need. For more
advanced report layout, be sure to try Wabit [http://www.sqlpower.ca/wabit], the open source reporting
tool from SQL Power.
62
Chapter 12. Troubleshooting
Although we have done our best to ensure you don't experience any problems when using Power*Architect,
there may be times when combinations of different database products, database configurations, and so on,
cause issues. We apologize in advance for any inconvenience this may cause.
If you are having trouble with Power*Architect, we ask that, in order to help us to diagnose the problem,
you take some or all of the following actions:
63
Chapter 13. Glossary
This section lists some database-related terms and their meanings.
Some of these terms are from FolDoc, "The Free On-line Dictionary of Computing", http://
www.foldoc.org/, Editor Denis Howe.
64
Glossary
65