Daug

Embed Size (px)

Citation preview

  • 7/27/2019 Daug

    1/856

    Sybase

    PowerDesigner

    Physical Data Model

    User's Guide

    Version 11.0DC38058-01-1100-01

    Last modified: November 2004

  • 7/27/2019 Daug

    2/856

    Copyright 1991-2004 Sybase, Inc. All rights reserved.Information in this manual may change without notice and does not represent a commitment on the part of Sybase, Inc. and itssubsidiaries.Sybase, Inc. provides the software described in this manual under a Sybase License Agreement. The software may be used only inaccordance with the terms of the agreement.No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual,optical, or otherwise, without the prior written permission of Sybase, Inc.Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.

    Sybase, SYBASE (logo), ADA Workbench, Adaptable Windowing Environment, Adaptive Component Architecture, Adaptive Server,Adaptive Server Anywhere, Adaptive Server Enterprise, Adaptive Server Enterprise Monitor, Adaptive Server Enterprise Replication,Adaptive Server Everywhere, Afaria, AppModeler, APT Workbench, APTBuild, APT-Edit, APT-Execute, APT-Translator, APT-Library, ASEP, AvantGo, AvantGo Application Alerts, AvantGo Mobile Document Viewer, AvantGo Mobile Delivery, AvantGoMobile Inspection, AvantGo Mobile Marketing Channel, AvantGo Mobile Pharma, AvantGo Mobile Sales, AvantGo Pylon, AvantGoPylon Application Server, AvantGo Pylon Conduit, AvantGo Pylon PIM Server, AvantGo Pylon Pro, Backup Server, BayCam, Bit-Wise, BizTracker, Certified PowerBuilder Developer, Certified SYBASE Professional, Certified SYBASE Professional Logo,ClearConnect, Client-Library, Client Services, CodeBank, Column Design, ComponentPack, Connection Manager, Convoy/DM,Copernicus, CSP, Data Pipeline, Data Workbench, DataArchitect, Database Analyzer, DataExpress, DataServer, DataWindow, DB-Library, dbQueue, Developers Workbench, Direct Connect Anywhere, DirectConnect, Distribution Director, Dynamic Mobility Model,e-ADK, E-Anywhere, e-Biz Integrator, E-Whatever, EC Gateway, ECMAP, ECRTP, eFulfillment Accelerator, Electronic CaseManagement, Embedded SQL, EMS, Enterprise Application Studio, Enterprise Client/Server, Enterprise Connect, Enterprise DataStudio, Enterprise Manager, Enterprise Portal (logo), Enterprise SQL Server Manager, Enterprise Work Architecture, Enterprise Work Designer, Enterprise Work Modeler, eProcurement Accelerator, eremote, Everything Works Better When Everything Works Together,EWA, Financial Fusion, Financial Fusion (and design), Financial Fusion Server, Formula One, Fusion Powered e-Finance, FusionPowered Financial Destinations, Fusion Powered STP, Gateway Manager, GeoPoint, GlobalFIX, iAnywhere, iAnywhere Solutions,ImpactNow, Industry Warehouse Studio, InfoMaker, Information Anywhere, Information Everywhere, InformationConnect, InstaHelp,Intelligent Self-Care, InternetBuilder, iremote, iScript, Jaguar CTS, jConnect for JDBC, KnowledgeBase, Logical Memory Manager,

    M-Business Channel, MBusiness Network, M-Business Server, Mail Anywhere Studio, MainframeConnect, Maintenance Express,Manage Anywhere Studio, MAP, MDI Access Server, MDI Database Gateway, media.splash, Message Anywhere Server, MetaWorks,MethodSet, ML Query, MobiCATS, My AvantGo, My AvantGo Media Channel, My AvantGo Mobile Marketing, MySupport, Net-Gateway, Net-Library, New Era of Networks, Next Generation Learning, Next Generation Learning Studio, O DEVICE, OASiS,OASiS logo, ObjectConnect, ObjectCycle, OmniConnect, OmniSQL Access Module, OmniSQL Toolkit, Open Biz, Open BusinessInterchange, Open Client, Open ClientConnect, Open Client/Server, Open Client/Server Interfaces, Open Gateway, Open Server, OpenServerConnect, Open Solutions, Optima++, Orchestration Studio, Partnerships that Work, PB-Gen, PC APT Execute, PC DB-Net, PCNet Library, PhysicalArchitect, Pocket PowerBuilder, PocketBuilder, Power++, Power Through Knowledge, power.stop, PowerAMC,PowerBuilder, PowerBuilder Foundation Class Library, PowerDesigner, PowerDimensions, PowerDynamo, Powering the NewEconomy, PowerScript, PowerSite, PowerSocket, Powersoft, PowerStage, PowerStudio, PowerTips, Powersoft Portfolio, PowersoftProfessional, PowerWare Desktop, PowerWare Enterprise, ProcessAnalyst, QAnywhere, Rapport, Relational Beans, RemoteWare,RepConnector, Report Workbench, Report-Execute, Replication Agent, Replication Driver, Replication Server, Replication ServerManager, Replication Toolkit, Resource Manager, RW-DisplayLib, RW-Library, SAFE, SAFE/PRO, SDF, Secure SQL Server, SecureSQL Toolset, Security Guardian, SKILS, smart.partners, smart.parts, smart.script, SQL Advantage, SQL Anywhere, SQL AnywhereStudio, SQL Code Checker, SQL Debug, SQL Edit, SQL Edit/TPU, SQL Everywhere, SQL Modeler, SQL Remote, SQL Server, SQLServer Manager, SQL SMART, SQL Toolset, SQL Server/CFT, SQL Server/DBM, SQL Server SNMP SubAgent, SQL Station, SQLJ,Stage III Engineering, Startup.Com, STEP, SupportNow, S.W.I.F.T. Message Format Libraries, Sybase Central, Sybase Client/ServerInterfaces, Sybase Development Framework, Sybase Financial Server, Sybase Gateways, Sybase IQ, Sybase Learning Connection,

    Sybase MPP, Sybase SQL Desktop, Sybase SQL Lifecycle, Sybase SQL Workgroup, Sybase Synergy Program, Sybase Virtual ServerArchitecture, Sybase User Workbench, SybaseWare, Syber Financial, SyberAssist, SybFlex, SybMD, SyBooks, System 10, System 11,System XI (logo), SystemTools, Tabular Data Stream, The Enterprise Client/Server Company, The Extensible Software Platform, TheFuture Is Wide Open, The Learning Connection, The Model For Client/Server Solutions, The Online Information Center, The Power of One, TotalFix, TradeForce, Transact-SQL, Translation Toolkit, Turning Imagination Into Reality, UltraLite, UltraLite.NET, UNIBOM,Unilib, Uninull, Unisep, Unistring, URK Runtime Kit for UniCode, Viewer, VisualWriter, VQL, WarehouseArchitect, WarehouseControl Center, Warehouse Studio, Warehouse WORKS, Watcom, Watcom SQL, Watcom SQL Server, Web Deployment Kit,Web.PB, Web.SQL, WebSights, WebViewer, WorkGroup SQL Server, XA-Library, XA-Server, XcelleNet, and XP Server aretrademarks of Sybase, Inc. or its subsidiaries.

    All other trademarks are property of their respective owners.

  • 7/27/2019 Daug

    3/856

    PDM User's Guide iii

    Contents

    About This Book .........................................................................................xvii

    1 Physical Data Model Basics ..............................................1What is a PDM?........................................................................ 2

    Operational PDM................................................................ 3Business Intelligence PDM................................................. 3Logical model ..................................................................... 4

    Objects in a PDM ............................................................... 5Defining the PDM environment ................................................. 7PDM DBMS ........................................................................ 7PDM extended model definitions........................................ 8PDM options..................................................................... 10PDM extended dependencies .......................................... 17PDM database properties................................................. 18

    Defining a PDM....................................................................... 19PDM properties ................................................................ 19Creating a PDM................................................................ 20Opening an existing PDM................................................. 24Detaching a PDM from the workspace............................. 25Saving and closing a PDM ............................................... 25Archiving a PDM............................................................... 25Creating a database ......................................................... 26

    Defining Packages in a PDM .................................................. 28PDM package properties.................................................. 29Modifying package display preferences ........................... 29

    Using SQL tools ...................................................................... 30Defining queries with the SQL Editor ............................... 30Previewing SQL statements ............................................. 32

    2 Using Business Rules in a PDM......................................35What is a business rule in a PDM?......................................... 36Defining business rules in a PDM ........................................... 37

    Business rule properties in a PDM ................................... 37

  • 7/27/2019 Daug

    4/856

    iv PowerDesigner

    Types of business rules in a PDM.................................... 37Creating a business rule in a PDM................................... 38Attaching an expression to a business rule in a PDM...... 39Using constraint business rules in a PDM........................ 40

    Using business rules in a PDM............................................... 45Applying a business rule to the current object in a PDM.. 45Applying a constraint business rule to a table or acolumn.............................................................................. 46

    3 Building Physical Diagrams ............................................ 49Physical diagram basics ......................................................... 50

    Defining a physical diagram ............................................. 50Why build a physical diagram?......................................... 50Creating a physical diagram............................................. 50

    Defining tables in a physical diagram ..................................... 51Table properties ............................................................... 51Creating a table ................................................................ 53Modifying table properties ................................................ 55Arranging items in a list attached to a table ..................... 55

    Naming a table constraint ................................................ 56Modifying the table display preferences ........................... 57Defining domains in a PDM .................................................... 61

    Domain properties in a PDM ............................................ 61Creating a domain in a PDM ............................................ 62Indicating data type, length, and precision....................... 63Selecting a data type for a domain in a PDM ................... 64Selecting a data type from a list of standard data typesin a PDM........................................................................... 66Modifying domain properties in a PDM ............................ 69Enforcing non-divergence from a domain in a PDM ........ 70

    Defining defaults in a PDM ..................................................... 73Default properties in a PDM ............................................. 73Creating a default in a PDM ............................................. 73Assigning a default to a column or a domain ................... 74Rebuilding defaults........................................................... 75

    Using abstract data types in a physical diagram..................... 77Types of abstract data types used in PowerDesigner ...... 77How are abstract data types used in PowerDesigner? .... 78Abstract data type properties ........................................... 79Creating an abstract data type ......................................... 80Creating an object (or a SQLJ object) abstract datatype................................................................................... 82Linking an abstract data type to a Java class................... 85Automatic linking to a Java class after reverseengineering....................................................................... 88Accessing a linked Java class in an OOM ....................... 88

  • 7/27/2019 Daug

    5/856

    PDM User's Guide v

    Defining columns in a physical diagram ................................. 92Column properties ............................................................ 92Column details.................................................................. 93Creating columns ............................................................. 94Creating a computed column ........................................... 95Creating a sequence for a column ................................... 97Selecting a data type for a column ................................. 103Attaching a column to a domain ..................................... 106Copying a column to another table................................. 107Naming a column constraint........................................... 108Configuring the display of the list of columns ................. 109

    Defining keys in a physical diagram...................................... 111Designating a primary key .............................................. 111Rebuilding primary keys ................................................. 112Designating a foreign key............................................... 113Adding parent table columns to a key ............................ 114Auto-migrating foreign keys............................................ 114Designating an alternate key .......................................... 117Naming key constraints.................................................. 119

    Defining references in a physical diagram............................ 122Reference properties...................................................... 123Defining model options for references ........................... 124Automatic reuse and migration of columns.................... 127Creating a reference....................................................... 129Defining reference joins.................................................. 130Changing a table at either end of a reference ................ 135Rebuilding references .................................................... 136Using referential integrity................................................ 138Referential integrity properties........................................ 139Defining referential integrity............................................ 141Modifying the reference display preferences.................. 143Modifying a reference graphically................................... 145

    Defining indexes in a physical diagram................................. 148

    Index properties.............................................................. 148Creating an index ........................................................... 150Removing a column from an index................................. 156Rebuilding indexes ......................................................... 157Deleting an index............................................................ 160

    Defining views in a physical diagram .................................... 161View properties............................................................... 161View columns ................................................................. 162View triggers................................................................... 164Creating a view............................................................... 164Modifying view properties ............................................... 168Using extended dependencies for views........................ 168Defining a query for a view ............................................. 169

  • 7/27/2019 Daug

    6/856

    vi PowerDesigner

    Assigning an alias to a table or a column....................... 174Defining query properties ............................................... 175Displaying query syntax.................................................. 179Defining a generation order for views............................. 180Modifying the view display preferences.......................... 183

    Defining view references in a physical diagram.................... 184View reference properties .............................................. 184Creating a view reference .............................................. 185Defining view reference joins ......................................... 186Changing a table or view at either end of a viewreference ........................................................................ 189Modifying the view reference display preferences ......... 189Modifying a view reference graphically........................... 190

    Defining query tables in a physical diagram ......................... 191Defining a view as a query table..................................... 191Defining an index in a query table .................................. 192

    Defining check parameters in a PDM ................................... 195Setting standard check parameters for objects in aPDM ............................................................................... 195Defining additional check parameters for objects in aPDM ............................................................................... 198Using a validation rule in check parameters in a PDM... 199Managing quotation marks around values ..................... 201

    Defining physical options for a PDM ..................................... 202Defining default physical options .................................... 203Defining physical options................................................ 205

    4 Building Multidimensional Diagrams ........................... 209Multidimensional diagram basics.......................................... 210

    Defining a multidimensional diagram ............................. 210Why build a multidimensional diagram?......................... 211Creating a multidimensional diagram............................. 211

    Defining dimensions in a multidimensional diagram............. 213Dimension properties ..................................................... 213Creating a dimension ..................................................... 214Modifying dimension properties...................................... 215Modifying the dimension display preferences ................ 216

    Defining attributes in a multidimensional diagram ................ 217Attribute properties in a multidimensional diagram ........ 217Creating an attribute in a multidimensional diagram ...... 218Modifying attribute properties in a multidimensionaldiagram .......................................................................... 219

    Defining hierarchies in a multidimensional diagram ............. 220Hierarchy properties ....................................................... 220Creating a hierarchy....................................................... 221Modifying hierarchy properties ....................................... 222

  • 7/27/2019 Daug

    7/856

    PDM User's Guide vii

    Defining cubes in a multidimensional diagram ..................... 223Cube properties.............................................................. 223Creating a cube .............................................................. 224Modifying cube properties .............................................. 225Modifying the cube display preferences ......................... 226

    Defining facts in a multidimensional diagram ....................... 227Fact properties ............................................................... 227Creating a fact ................................................................ 228Modifying fact properties from the list of facts................ 229

    Defining measures in a multidimensional diagram............... 231Measure properties ........................................................ 231Creating a measure........................................................ 232Modifying measure properties ........................................ 232

    Defining associations in a multidimensional diagram........... 235Association properties in a multidimensional diagram ... 235Creating an association in a multidimensional diagram. 235Modifying association properties in a multidimensionaldiagram .......................................................................... 237Modifying the association display preferences in amultidimensional diagram .............................................. 237

    5 Denormalizing a Physical Data Model ..........................239Overview............................................................................... 240Horizontal partitioning ........................................................... 241

    Using the Horizontal Partitioning Wizard........................ 242Using the horizontal partitioning object........................... 243Managing horizontal partitions........................................ 245Intermodel generation of horizontal partitions ................ 245Revert a horizontal partitioning....................................... 247

    Vertical partitioning ............................................................... 248Using the Vertical Partitioning Wizard ............................ 248Using the vertical partitioning object............................... 250Managing vertical partitions............................................ 252Intermodel generation of vertical partitions .................... 252Revert a vertical partitioning ........................................... 254

    Table collapsing .................................................................... 256Using the Table Collapsing Wizard ................................ 257Using the table collapsing object .................................... 258Intermodel generation of table collapsing....................... 259Revert a table collapsing ................................................ 259

    Column denormalization ....................................................... 261Using the Column Denormalization Wizard ................... 261Intermodel generation of denormalized columns ........... 263Revert a column denormalization................................... 263

  • 7/27/2019 Daug

    8/856

    viii PowerDesigner

    6 Working with Physical Data Models ............................. 265Checking a PDM................................................................... 266

    PDM check options ........................................................ 266Object selection for Check Model .................................. 267Checking a global PDM.................................................. 268Displaying previously applied check options .................. 271

    Making corrections based on PDM check results .......... 271Object parameters verified during check model ................... 274Horizontal partitioning check .......................................... 274Table collapsing check................................................... 275Vertical partitioning check .............................................. 276Business Rule check in a PDM ...................................... 277Package check............................................................... 277User check ..................................................................... 279Group check................................................................... 280Role check ..................................................................... 281Domain check ................................................................ 282Table check.................................................................... 283Column check ................................................................ 286Index check .................................................................... 289View index check............................................................ 291Key check....................................................................... 292Trigger check ................................................................. 294Reference check ............................................................ 294View reference check..................................................... 296View check ..................................................................... 297Abstract data type check ................................................ 297Abstract data type procedure check ............................... 298Synonym check .............................................................. 300Database package check............................................... 300Database package procedure check ............................. 302Database package cursor check.................................... 304Database package variable check ................................. 305

    Database package type check ....................................... 305Database package exception check .............................. 306Procedure check ............................................................ 306Data source check ......................................................... 307File object check ............................................................ 308Cube check .................................................................... 309Fact check...................................................................... 310Fact measure check....................................................... 311Dimension check............................................................ 311Attribute check ............................................................... 313Dimension hierarchy check ............................................ 313Association check .......................................................... 314Join index check............................................................. 314

  • 7/27/2019 Daug

    9/856

    PDM User's Guide ix

    Replication check ........................................................... 316Default check.................................................................. 316Storage check ................................................................ 317Tablespace check .......................................................... 318Extended object check ................................................... 319Extended link check ....................................................... 319Web service check ......................................................... 320Web operation check ..................................................... 320

    Mapping objects in a PDM.................................................... 322Understanding object mapping....................................... 322Defining data sources in a PDM..................................... 323Defining a relational to relational mapping ..................... 326Defining a relational to multidimensional mapping......... 332

    Retrieving multidimensional objects ..................................... 341Rebuilding cubes .................................................................. 343Generating extraction scripts ................................................ 346Generating Cube Data .......................................................... 348

    Defining the query of a cube .......................................... 348Generating a text file ...................................................... 349

    Migrating from version 6 data warehouse............................. 351Comparing version features ........................................... 351Converting objects from version 6.................................. 351Converting external sources........................................... 353

    Using PowerBuilder extended attributes............................... 355Importing the PowerBuilder extended model definition .. 355Importing models with PowerBuilder extendedattributes from a previous version .................................. 357Modifying the value of a PowerBuilder extendedattribute .......................................................................... 358Generating PowerBuilder extended attributes................ 359Reverse engineering PowerBuilder extended attributes 360

    Importing an ERwin model into a PDM ................................. 362Migrating from ERwin ..................................................... 363

    7 Reverse Engineering in a PDM......................................365Reverse engineering a database schema ............................ 366

    Defining reverse engineering options............................. 366Reverse engineering shortcuts....................................... 368Generating a PDM from a database .............................. 369Filters and options for reverse engineering .................... 370Optimizing ODBC reverse engineering queries ............. 371Reverse engineering into a new PDM............................ 372Reverse engineering into an existing PDM .................... 379Reverse engineering a Microsoft Access 97 database .. 387

  • 7/27/2019 Daug

    10/856

    x PowerDesigner

    8 Triggers and Procedures............................................... 389Trigger overview ................................................................... 390

    How to design triggers.................................................... 390Using triggers........................................................................ 393

    Trigger properties........................................................... 393Defining triggers with multiple events ............................. 394

    Using variables in triggers .............................................. 395Creating triggers automatically....................................... 395Creating a trigger manually ............................................ 401Modifying a trigger.......................................................... 403Indicating trigger order ................................................... 406Multiple triggers .............................................................. 406Previewing a trigger........................................................ 408

    Using trigger templates......................................................... 409Identifying PowerDesigner pre-defined trigger templatetypes............................................................................... 410Trigger template properties ............................................ 412Using variables in trigger templates ............................... 413Creating a trigger template............................................. 414Modifying a trigger template ........................................... 421Trigger naming conventions........................................... 426Changing trigger naming conventions............................ 426Calling a related procedure in a trigger template ........... 427

    Using template items ............................................................ 428Identifying template items............................................... 430Template item properties ............................................... 432Using variables in template items .................................. 432Creating a template item ................................................ 433Modifying a template item .............................................. 439Declaring a template item in a trigger definition ............. 441

    Defining stored procedures and functions ............................ 443Defining templates for stored procedures andfunctions......................................................................... 443

    Creating stored procedures and functions ..................... 444Attaching a stored procedure to a table ......................... 449Using macros........................................................................ 451

    AKCOLN......................................................................... 451ALLCOL.......................................................................... 452DEFINE .......................................................................... 452DEFINEIF....................................................................... 453ERROR .......................................................................... 453FKCOLN......................................................................... 454FOREACH_CHILD......................................................... 454FOREACH_COLUMN .................................................... 455FOREACH_PARENT ..................................................... 456INCOLN.......................................................................... 457

  • 7/27/2019 Daug

    11/856

    PDM User's Guide xi

    JOIN ............................................................................... 458NMFCOL ........................................................................ 458PKCOLN......................................................................... 459CLIENTEXPRESSION and SERVEREXPRESSION..... 459SQLXML......................................................................... 460

    Using the SQL/XML Wizard.................................................. 462Generating triggers and procedures ..................................... 469

    Trigger and procedure creation parameters................... 470Generation script options ............................................... 470Object selection parameters .......................................... 472Defining a generation order for stored procedures ........ 472Generating a trigger or procedure creation script .......... 476Creating triggers directly in a database.......................... 478Creating and generating user-defined error messages.. 479

    9 Web services in databases............................................483Defining Web services .......................................................... 484

    Web services in PowerDesigner .................................... 484Defining Web services properties .................................. 487

    Creating a Web service.................................................. 490Defining Web operations properties............................... 492Creating a Web operation .............................................. 497Defining Web parameters general properties ................ 500Defining result columns general properties.................... 501

    Generating Web services ..................................................... 502Generating Web services for Sybase ASA 9 ................. 502Generating Web services for IBM DB2 v8.1 .................. 512

    Reverse engineering Web services...................................... 516Reverse engineering Web services from SybaseASA 9 ............................................................................. 517

    10 Database Creation and Modification.............................527Using the ODBC interface .................................................... 528

    Defining an ODBC data source ...................................... 529Configuring an ODBC data source................................. 529Connecting to an ODBC data source ............................. 531Displaying information about a connected database...... 532Disconnecting from a data source.................................. 532

    Accessing a database........................................................... 533Changing target DBMS .................................................. 533Displaying data from a database.................................... 537Executing SQL queries................................................... 538

    Configuring tablespace and storage ..................................... 540Defining tablespace and storage.................................... 540Previewing tablespace and storage commands............. 543

  • 7/27/2019 Daug

    12/856

    xii PowerDesigner

    Sample tablespace and storage commands.................. 545Estimating database size...................................................... 546

    Indicating the number of records in a table .................... 547Indicating average data type length................................ 548Estimating the database size of a model ....................... 549Estimating the database size of selected tables ............ 550

    Customizing scripts............................................................... 552Script toolbar properties ................................................. 552Inserting begin and end scripts for database creation ... 552Inserting begin and end scripts for table creation .......... 556Inserting begin and end script for tablespace creation... 557Formatting variables in customized scripts .................... 558

    Generating a database ......................................................... 559Creation parameters for tables, columns, and views ..... 560Creation parameters for keys, indexes, and joinindexes ........................................................................... 562Database creation parameters....................................... 564Generation script options ............................................... 566Object selection parameters .......................................... 567Selecting objects for generation ..................................... 569Generating a database creation script ........................... 571Creating a database directly........................................... 572Generating a Microsoft Access 97 database ................. 574

    Modifying a database............................................................ 575Database generation synchronization parameters......... 575Database modification script options ............................. 576Generating a modified database .................................... 577

    Using test data...................................................................... 586Creating a test data profile ............................................. 587Automatic test data generation source parameters ....... 589Defining a list as a test data generation source ............. 596Defining an ODBC data source as a test datageneration source........................................................... 597

    Selecting an ODBC data source .................................... 599Defining a file as a test data generation source ............. 599Defining column fill parameters ...................................... 601Assigning a data profile .................................................. 603Importing a data profile .................................................. 607Exporting a data profile .................................................. 607Generating test data....................................................... 608

    11 Managing Database Access .......................................... 619Understanding database access management .................... 620Managing database users .................................................... 621

    Defining a user ............................................................... 621Defining a role ................................................................ 624

  • 7/27/2019 Daug

    13/856

    PDM User's Guide xiii

    Defining a group ............................................................. 626Managing system privileges.................................................. 629

    Analyzing system privileges ........................................... 629Defining system privileges.............................................. 629

    Managing object permissions ............................................... 634Analyzing object permissions ......................................... 634Defining object permissions ........................................... 634Defining column permissions ......................................... 641

    Generating privileges ............................................................ 644Creation parameters for users, groups and roles........... 644Generating privileges ..................................................... 646

    Managing synonyms............................................................. 648Defining a synonym ........................................................ 648Creating a synonym........................................................ 649Creating a view for a synonym ....................................... 651Generating synonyms..................................................... 652Reverse engineering synonyms ..................................... 655

    12 Generating from a Physical Data Model .......................657

    Generation basics ................................................................. 658Target models parameters ............................................. 658Object selection parameters .......................................... 660

    Generating a Physical Data Model from a Physical DataModel .................................................................................... 661

    Why generate a PDM into a PDM? ................................ 661Generating and updating a PDM.................................... 662

    Generating a Conceptual Data Model from a PhysicalData Model............................................................................ 671

    Generating CDM objects ................................................ 671Translating PDM to CDM data types.............................. 671Generating and updating a CDM.................................... 673Migrating models from version 6 .................................... 680

    Generating an Object-Oriented Model from a PhysicalData Model............................................................................ 683

    Generating OOM Objects............................................... 683Translating PDM to OOM data types ............................. 684Generating and updating an OOM ................................. 684

    Generating an XML Model from a Physical Data Model....... 693Generating XML Model objects ...................................... 693Generating and updating an XML Model........................ 693Defining XML Model generation options ........................ 695Generating a new XML model from a PDM ................... 697Updating an existing XML model.................................... 698Generating an XML model via the XML Builder Wizard. 701

  • 7/27/2019 Daug

    14/856

    xiv PowerDesigner

    13 DBMS-specific Features ................................................ 711Logical................................................................................... 712

    Why build a logical model? ............................................ 712Inheritance in the logical PDM........................................ 712

    IBM DB 2............................................................................... 716IBM DB 2 indexes........................................................... 716

    Tablespace prefix........................................................... 716Multiple databases in a model ........................................ 719IBM DB 2 extended attributes ........................................ 722Bind package.................................................................. 724

    MS Access............................................................................ 725Reverse Engineering a MS Access 97 Database .......... 725MS Access extended attributes...................................... 726

    Support for Oracle ................................................................ 727Special variables for triggers .......................................... 727Object (or SQLJ object) data types................................ 727Bitmap join indexes ........................................................ 730Database package ......................................................... 737Reverse engineering tablespace physical options ......... 748Reverse engineering ASC/DESC indexes ..................... 749Managing Oracle dimensions......................................... 749Oracle extended attributes ............................................. 752

    Support for Sybase Adaptive Server IQ ................................ 754Accessing Sybase AS IQ features ................................. 754Creating a new PDM using Sybase AS IQ ..................... 755Reverse engineering an existing Sybase AS IQdatabase......................................................................... 755Checking a model built with IQ 12.4.3............................ 755Changing the target DBMS of an existing PDM ............. 755Defining IQ indexes........................................................ 756Rebuilding IQ indexes .................................................... 757Defining IQ join indexes ................................................. 759Join index properties ...................................................... 760

    Rebuild join indexes for all references linked to a facttable................................................................................ 760Creating a join index from the table property sheet ....... 763Creating a join index in the list of join indexes ............... 763Adding references to a join index ................................... 766Generating a Sybase AS IQ database ........................... 768Sybase AS IQ database parameters.............................. 768Generating a Sybase AS IQ database creation script.... 768Sybase IQ extended attributes ....................................... 772

    Sybase Adaptive Server Enterprise ...................................... 773Identity columns ............................................................. 773Sybase Adaptive Server Enterprise extendedattributes......................................................................... 774

  • 7/27/2019 Daug

    15/856

    PDM User's Guide xv

    Sybase Adaptive Server Anywhere....................................... 775Auto-increment columns ................................................ 775Sybase Adaptive Server Anywhere extended attributes 775

    Interbase extended attributes ............................................... 776MS SQL Server..................................................................... 777

    SQL Server Analysis Services concepts ........................ 777Comparing PowerDesigner and DSO metamodels........ 778Enabling Microsoft Analysis Services inPowerDesigner............................................................... 779Generating cubes ........................................................... 780Reverse Engineering cubes ........................................... 781Customizing multi-dimensional objects .......................... 783

    NonStop SQL extended attributes ........................................ 788PostgreSQL extended attributes........................................... 789Informix extended attributes ................................................. 790MySQL extended attributes .................................................. 791

    Appendix Variables in PowerDesigner..........................................793List of PowerDesigner variables ........................................... 794

    List of PowerDesigner formatting variables .......................... 806

    PDM Glossary .........................................................................................807

    Index .........................................................................................811

  • 7/27/2019 Daug

    16/856

    xvi PowerDesigner

  • 7/27/2019 Daug

    17/856

    PDM User's Guide xvii

    About This Book

    This book describes the PowerDesigner Physical Data Model data modelingenvironment. It shows you how to do the following:

    Build a Physical Data Model (PDM) using Physical andMultidimensional diagrams

    Create and use business rules and other model objects

    Generate triggers, procedures, scripts, and databases

    Generate databases

    Reverse engineer existing databases Generate a Physical Data Model, a Conceptual Data Model and an

    Object-Oriented data Model from a PDM

    This book is for anyone who will be building data models withPowerDesigner. Although it does not assume you have knowledge about anyparticular topic, having some familiarity with relational databases, SQL, anddesign methodology is helpful. For more information, see the Bibliographysection at the end of this chapter.

    The PowerDesigner modeling environment supports several types of models:

    Conceptual Data Model (CDM) to model the overall logical structureof a database, independent from any software or data storage structureconsiderations

    Physical Data Model (PDM) to model the overall physical structure of a database, taking into account DBMS software or data storage structureconsiderations

    Object Oriented Model (OOM) to model a software system using anobject-oriented approach for Java or other object languages

    Business Process Model (BPM) to model the means by which one ormore processes are accomplished in operating business practices

    Subject

    Audience

    Documentationprimer

  • 7/27/2019 Daug

    18/856

    About This Book

    xviii PowerDesigner

    XML Model (XSM) to model the structure of an XML file using a DTDor an XML schema

    Requirements Model (RQM) to list and document the customer needsthat must be satisfied during a development process

    Information Liquidity Model (ILM) to model the replication of

    information from a source database to one or several remote databasesusing replication engines

    Free Model (FEM) to create any kind of chart, diagram, in a context-free environment

    This book only explains the Physical Data Model. For information on othermodels or aspects of PowerDesigner, consult the following books:

    General Features Guide To get familiar with the PowerDesignerinterface before learning how to use any of the models.

    Conceptual Data Model Getting Started To learn the basics of theCDM.

    Conceptual Data Model Users Guide To work with a CDM.

    Physical Data Model Getting Started To learn the basics of the PDM.

    Object Oriented Model Getting Started To learn the basics of theOOM.

    Object Oriented Model User's Guide To work with an OOM.

    Business Process Model User's Guide To work with a BPM.

    Business Process Model Getting Started To learn the basics of theBPM.

    XML Model User's Guide To work with an XSM.

    Information Liquidity Model User's Guide To work with an ILM.

    Requirements Model User's Guide To work with an RQM.

    Reports Users Guide To create reports for any or all models.

    Repository Users Guide To work in a multi-user environment using acentral repository.

    Repository Getting Started To learn the basics of the Repository.

  • 7/27/2019 Daug

    19/856

    About This Book

    PDM User's Guide xix

    PowerDesigner documentation uses specific typefaces to help you readilyidentify specific items: monospace text (normal and bold )

    Used for: Code samples, commands, compiled functions and files,references to variables.Example: declare user_defined, theBeforeInsertTrigger template.

    UPPER CASEObject codes, reversed objects, file names + extension.Example: The AUTHOR table appears in the Browser. Open the fileOOMAFTER.OOM.

    bold textAny new term.Example: A shortcut has a target object.

    SMALL CAPS

    Any key name.Example: Press the ENTER key.

    Data Modeling Essentials

    Graeme Simsion, Van Nostrand Reinhold, 1994, 310 pages; paperbound;ISBN 1850328773

    Information engineering

    James Martin, Prentice Hall, 1990, three volumes of 178, 497, and 625 pagesrespectively; clothbound, ISBN 0-13-464462-X (vol. 1), 0-13-464885-4 (vol.

    2), and 0-13-465501-X (vol. 3).

    Celko95

    Joe Celko, Joe Celko's SQL for Smarties (Morgan Kaufmann Publishers,Inc., 1995), 467 pages; paperbound; ISBN 1-55860-323-9.

    Typographicconventions

    Bibliography

  • 7/27/2019 Daug

    20/856

    About This Book

    xx PowerDesigner

  • 7/27/2019 Daug

    21/856

    PDM User's Guide 1

    C H A P T E R 1

    Physical Data Model Basics

    This chapter presents the Physical Data Model (PDM) and explains the roleof physical and multidimensional modeling in the design process.

    Topic Page

    What is a PDM? 2

    Defining the PDM environment 7

    Defining a PDM 19

    Defining Packages in a PDM 28

    Using SQL tools 30

    About this chapter

    Contents

  • 7/27/2019 Daug

    22/856

    What is a PDM?

    2 PowerDesigner

    What is a PDM?The PDM is a database design tool for defining the implementation of physical structures and data queries.

    Depending on the type of database you want to design, you will use different

    types of diagrams in the PDM.

    Database Diagram

    Operational Physical diagram to define the physical implementation of thedatabase

    Date warehouseor Data mart

    Physical diagram to store business data

    OLAP Multidimensional diagram to define the possible queries toperform on the operational data

  • 7/27/2019 Daug

    23/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 3

    Operational PDM

    The physical diagrams of the PDM are used to design the structure of adatabase handling large amounts of operational data. Usually, the physicalanalysis follows the conceptual analysis in data modeling. At the physicalstage, the designer considers the details of actual physical implementation of

    data in a database.Since operational data are highly volatile and likely to be modified regularly,the database should be designed to accelerate data access and retrieval.

    The physical diagrams of the PDM allow to take into account both softwareor data storage structures to suit your performance and physical constraints.

    For more information on how to build a physical diagram, see chapterBuilding Physical Diagrams.

    Business Intelligence PDM

    You can use a PDM to design the structure of a data warehouse handlingbusiness data. A data warehouse environment is made of:

    A data warehouse or data mart database

    An OLAP database and tools for sending queries to the database

    Data warehouse and data mart databases store historical business datafrom heterogeneous systems. The data warehouse database gathers all thedata manipulated in a company for example, whereas the data mart focuseson smaller entities in the company.

    Data warehouse and data mart databases are populated with data proceedingfrom different operational sources. This data transfer is implemented via arelational to relational mapping, the operational database being the data

    source of the data warehouse or data mart database. For more information on relational to relational mapping see sectionMapping objects in a PDM in chapter Working with Physical Data Models.

    The purpose of maintaining such type of database is to gather in a centralarea all the information that may be needed in an OLAP database wherequeries for business analysis and decision making are performed.

    You use physical diagrams to design a data warehouse or data mart database.Since these databases usually contain very large amounts of data for storage,you do not need to design them for performance. You may assign types (factand dimension) to the database tables to have a preview of themultidimensional structure in an OLAP database.

    Data warehouseand data martdatabase

  • 7/27/2019 Daug

    24/856

    What is a PDM?

    4 PowerDesigner

    An OLAP database shows a multidimensional view of business data.Information in an OLAP database is organized to facilitate the queriesperformed by different tools. Business analysts use OLAP databases to sendqueries and retrieve business information from the different dimensionsexisting in the database.

    OLAP databases are populated with data usually proceeding from a datawarehouse or data mart database. This data transfer is implemented via arelational to multidimensional mapping, the data warehouse or data martdatabase being the data source of the OLAP database.

    However, when there are no large amounts of data, it is possible to have adata transfer directly from the operational database to the OLAP engine. Forclarity purpose, we will not develop the operational to OLAP transfer of information in this book.

    For more information on relational to multidimensional mapping seesection Mapping objects in a PDM in chapter Working with Physical DataModels.

    You have to use multidimensional diagrams to design the differentdimensions and cubes within the OLAP database.

    Logical model

    The logical model allows you to design the database structure and performsome database denormalization actions. This model is independent from anyDBMS physical requirement.

    In PowerDesigner, you can design a logical model using a PDM with the DBMS. This PDM is a physical model with standardobjects, and without DBMS specific physical options and generationcapabilities.

    For more information on the logical model, see section Logical inchapter DBMS-specific Features.

    OLAP database

  • 7/27/2019 Daug

    25/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 5

    Objects in a PDM

    The PDM includes different types of diagrams, with their objects:

    Object Tool Description

    Table Collection of rows (records) that have associated

    columns (fields)Column Data structure that contains an individual data item

    within a row (record), model equivalent of a databasefield.

    Key Column or columns whose values uniquely identify eachrow in a table. A key can be designated as a primary oralternate key

    Primary key Column or columns whose values uniquely identify eachrow in a table, and are designated as the primaryidentifier of each row in the table

    Alternatekey

    Column or columns whose values uniquely identify eachrow in a table, and which is not a primary key

    Foreign key Column or columns whose values depend on andmigrate from a primary or alternate key in another table.

    Index Data structure associated with one or more columns in atable, in which the column values are ordered in such away as to speed up access to data

    Reference Link between a primary or an alternate key in a parenttable, and a foreign key of a child table. Depending onits selected properties, a reference can also link columnsthat are independent of primary or alternate key columns

    View Data structure that results from a SQL query and that isbuilt from data in one or more tables

    Procedure Precompiled collection of SQL statements stored undera name in the database and processed as a unit

    Web service Collection of SQL statements stored in a database toretrieve relational data in HTML, XML, WSDL or plaintext format, through HTTP or SOAP requests

    Weboperation

    Sub-object of a Web service containing a SQL statementand displaying Web parameters and result columns

    Physical objects

  • 7/27/2019 Daug

    26/856

    What is a PDM?

    6 PowerDesigner

    Object Tool Description

    Cube Collection of measures related to aspects of the businessand used to carry out a decision support investigation

    Fact Group of measures used among cubes

    Dimension Axis of investigation of a cube (time, product,geography)

    Association Association that relates a cube to a dimension

    Attribute Used to qualify a dimension. For example, attributeYear qualifies the Date dimension

    FactMeasure

    Variable linked to a fact, used as the focus of a decisionsupport investigation

    Hierarchy Organizational structure that describes a traversalpattern though a dimension

    Multidimensionalobjects

  • 7/27/2019 Daug

    27/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 7

    Defining the PDM environmentThe PDM environment includes a set of parameters and configurationoptions that define various aspects of the model content and behavior. Youcan set these parameters:

    At model creation After creating a model with default options and parameters

    When creating a model template

    PDM DBMS

    PowerDesigner can be used with many different DBMS. For each of theseDBMS, a standard definition file is included and provides an interfacebetween PowerDesigner and the DBMS so as to establish the bestrelationships between them.

    Caution You should never modify the DBMS files shipped with PowerDesigner.For each original DBMS you want to modify, you should create acorresponding new DBMS. To do so you have to create a new DBMS fromthe List of DBMS, define a name and select the original file in the CopyFrom dropdown listbox. This allows you to create a new DBMS that isidentical to the original file apart from the name.

    A DBMS definition file is a list of values and settings that representspecifications for a particular Database Management System (DBMS) in aformat understandable by PowerDesigner. As an interface between an actualDBMS and PowerDesigner, it provides PowerDesigner with the syntax and

    guidelines for generating databases, triggers, and stored proceduresappropriate for a target DBMS. The file itself is in .XML format.

    The DBMS definition file is a required component of PowerDesigner whenworking with Physical Data Models (PDM). Each actual DBMS supported byPowerDesigner has its own DBMS definition.

    For more information on the DBMS definition file, see chapter DBMSReference Guide in the Advanced User documentation .

    All DBMS definition files have the same structure made up of a number of categories . A category can contain sub-categories , and entries . Theseentries are parameters recognizable by PowerDesigner.

    What is a DBMSdefinition file?

    What is containedin a DBMSdefinition?

  • 7/27/2019 Daug

    28/856

    Defining the PDM environment

    8 PowerDesigner

    The values for DBMS definition categories and entries vary for each DBMS.Some entries may not exist in the DBMS file if they are not applicable to theparticular DBMS.

    For more information on the DBMS editor, see chapter The ResourceEditor in the General Feature Guide .

    Not certified resource fileSome resource files are delivered with "Not Certified" in their names.Sybase will perform all possible validation checks, however Sybase doesnot maintain specific environments to fully certify these resource files.Sybase will support the definition by accepting bug reports and willprovide fixes as per standard policy, with the exception that there will beno final environmental validation of the fix. Users are invited to assistSybase by testing fixes of the definition provided by Sybase and reportany continuing inconsistencies.

    PDM extended model definitionsExtended model definitions (.XEM files) provide means for customizing andextending PowerDesigner metaclasses, parameters and generation. Extendedmodel definitions are typed like models in PowerDesigner. You create anextended model definition for a specific type of model and you cannot sharethese files between heterogeneous models.

    Extended model definitions may contain:

    Extended attributes for applicable objects in order to further define theirproperties

    Stereotypes to define extended dependencies established between modelobjects

    For more information on extended dependencies, see section PDMextended dependencies.

    Generation targets and commands to complement the generation of anobject model, or to perform an extended generation

  • 7/27/2019 Daug

    29/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 9

    When you create a new PDM, or when you reverse engineer into a newPDM, you can select one or several extended model definitions and attachthem to the model from the Extended Model Definitions page of the Newdialog box.

    You can choose one of the following options:

    Option Definition

    Share Current extended model definition constantly refers to the extendedmodel definition stored in the Resource Files\Extended ModelDefinitions directory. Any changes made to the extended modeldefinition are shared by all linked XEM

    Copy Current extended model definition is a unique copy of the extendedmodel definition stored in the Resource Files\Extended ModelDefinitions directory. The current extended model definition isindependent of the original one, so modifications made to theextended model definition in the Resource Files\Extended ModelDefinitions directory are not available to the copied XEM. This one issaved with the PDM and cannot be used without it

    For more information on extended model definitions, see chapterExtended Model Definitions Reference Guide, in the Advanced User

    Documentation.

  • 7/27/2019 Daug

    30/856

    Defining the PDM environment

    10 PowerDesigner

    PDM options

    You can set options that apply to a PDM for the following objects:

    All objects, see section All objects

    Notation, see section Notation

    Table and view, see section Table and view

    Column and domain, see section Column and domain

    Reference, see section Reference

    To define PDM options:

    1 Select Tools Model Options.or Right-click the diagram background and select Model Options from thecontextual menu.

    The Model Options dialog box opens to the Model Settings page.

    2 Select model options in the different boxes.

    3 Select different Model Settings sub-categories (Table and View, Columnand Domain, Reference) to define model options for different objects.

  • 7/27/2019 Daug

    31/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 11

    4 Click OK.

    All objects

    You can define the case sensitivity of names and codes for all objects in thecurrent model. When this check box is selected, it implies that you can havetwo objects with identical name or code but different case in the samenamespace.

    Unlike other model options, you can modify the name and code casesensitivity during the design process. However, if you do so, make sure yourun the check model feature to verify if the model does not contain anyduplicate object.

    Requirements are descriptions of customer needs that must be satisfiedduring development processes. Requirements are defined in requirementsmodels.

    You can enable links to requirements for all objects in the current model.When this check box is selected, it implies that the Requirements tab

    appears in the objects property sheet. The Requirements page allows you toattach requirements to objects; these requirements are defined in theRequirements models open in the workspace. Attached requirements andRequirements models are synchronized.

    For more information on requirements, see the Requirements ModelUsers Guide .

    Name/Code casesensitive

    Enable links torequirements

  • 7/27/2019 Daug

    32/856

    Defining the PDM environment

    12 PowerDesigner

    Notation

    From the Notation groupbox, you can choose to use one of the followingnotation types in the current model:

    Mode Displays Symbols

    Relational* Arrow pointing toprimary key

    CODASYL Arrow pointing toforeign key

    Conceptual Cardinality displayedin IE format (crow'sfeet)

    IDEF1X Cardinality andmandatory status

    displayed onreference, primarycolumns in separatecontainers anddependent tables withrounded rectangles.See below

    * This notation is the default notation used in this manual.

    When you change notation, all symbols in all diagrams are updatedaccordingly. Furthermore, when you switch from Merise to IDEF1X, allassociations are converted to relationships.

    Tables display rounded rectangles when they depend on another table(foreign key columns are also primary keys), and primary identifiers appearin separate containers:

    IDEF1X notation

  • 7/27/2019 Daug

    33/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 13

    References : Each set of symbols describes a combination of the optionalityand cardinality of the table next to it.

    Mandatory Non mandatory

    The reference display changes according to its cardinality:

    Table and view

    From the Table and View page in Model Options, you can choose to ignoreor consider the identifying owner of a table or view. When a table or view iscreated, it can be assigned an owner by selecting one from a list of users. Theowner is usually the creator of the table or view.

    If the Ignore identifying owner check box is not selected The nameand/or the code, and the owner are identifying properties of the table or view.A uniqueness check for tables and views is implemented to take into accountthe owner. For example, a model can contain Table_1 belonging to User_1and Table_1 belonging to User_2: both tables have the same name butdifferent owners. You could also have Table_1 belonging to User_1 and

    Table_2 belonging to User_1.If the Ignore identifying owner check box is selected The nameand/or code become the only identifying properties of the table or view. Theowner is ignored. For example, a model can contain Table_1 belonging toUser_1 and Table_2 belonging to User_1, in this case, the owner is ignored,and it is impossible to have two tables with the same name and/or code in thesame namespace.

    From the Table and View page in Model Options, you can select the optionwhich automatically rebuilds triggers implementing referential integrityconstraints.

    Ignore identifyingowner

    Rebuildautomaticallytriggers

  • 7/27/2019 Daug

    34/856

    Defining the PDM environment

    14 PowerDesigner

    Note: If this option is not selected, you must rebuild triggers by selectingTools Rebuild Objects Rebuild Triggers.

    The Rebuild automatically triggers option ensures that triggers are always up-to-date.

    When you change the implementation of a reference The trigger is

    rebuilt on the child and parent tables of the reference.

    When you change the referential integrity rules of a referenceimplemented by a trigger The trigger is rebuilt on the child and parenttables of the reference.

    When you change the child or parent table of a referenceimplemented by a trigger The trigger is rebuilt on the new and old childor parent tables of the reference.

    When you create or delete a reference implemented by a trigger The trigger is rebuilt on the child and parent tables of the reference.

    Column and domainFrom the Column and Domain page in Model Options, you can choose toenforce non-divergence between a domain definition and the columns usingthe domain, for the following column properties:

    Property Columns in the domain cannot have divergent

    Data type Data type, length, and precision

    Check Check parameters

    Rules Business rules

    Mandatory Mandatory property of the column

    Profile Test data profile

    In this mode, the selected column properties must be consistent with thedomain properties.

    When you apply the Enforce non-divergence options You are askedif you want to apply domain properties to columns attached to the domain inthe current model.

    Enforce non-divergenceselected

  • 7/27/2019 Daug

    35/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 15

    If you accept to apply domain properties, the column properties aremodified in order to be consistent with domain properties. However, if the check parameters, business rules and mandatory properties of acolumn are more constrained than those of the domain, these propertieswill not be modified. You may indeed need to define a shorter range of values in the column check parameters, or set a column as mandatory

    while the domain is not If you refuse to apply domain properties, the column is detached from

    the domain

    When you modify the properties of a domain The properties of thecolumns attached to the domain are updated provided these properties areselected in the Model Options dialog box.

    Columns cannot be modified When you select a column property underEnforce non-divergence, each instance of that column property in the List of Columns and the Columns property sheet appears grayed and can not bemodified.

    If you want to modify a column property that is defined as non-divergent, youmust detach the column from its domain, or clear the Enforce non-divergencecheck box in Model Options.

    In this mode, it is still possible to select column properties under Enforcenon-divergence.

    If you select one or more of the column properties When you modifya column property so that it diverges from its current domain definition, youare asked if you want to keep the modifications and diverge from the domain.

    If you do not select column properties When you modify a column ordomain property resulting in a divergence, you are not warned, and you canno longer cascade the change on the column properties.

    From the Column and Domain panel in Model Options, you can set thedefault data type.

    The default data type is the data type that applies to columns and domains if no data type is selected.

    Enforce non-divergence cleared

    Default data type

  • 7/27/2019 Daug

    36/856

    Defining the PDM environment

    16 PowerDesigner

    Reference

    From the Reference page in Model Options, you can select the followingmodel options for references in your PDM:

    Option Result

    Unique code Requires that references have unique codes

    Auto-reusecolumns

    An existing column in child table is used as the matchingforeign key column when both of the following conditionsapply:

    Child column has same code as migrating primary keycolumn

    Child column is not already a foreign key column

    Auto-migratecolumns

    Primary key columns are automatically migrated to a childtable as foreign key columns at reference creation. You canalso choose to migrate any of the following columnproperties: Domain, Check (Check parameters), Rules(Business rules)

    Domain At reference creation, if Auto-migrate columns and Domainare selected, the domain on the PK is migrated to the FK.During intermodel generation, whatever the state of the Auto-migrate columns check box, if Domain is selected, thedomain on the PK is migrated to the FK

    Check At reference creation, if Auto -migrate columns and Check are selected, the check parameters on the PK are migrated tothe FK. During intermodel generation, whatever the state of the Auto-migrate columns check box, if Check is selected, thecheck parameters on the PK are migrated to the FK

    Rules At reference creation, if Auto-migrate columns and Rules areselected, the business rules on the PK are migrated to the FK.During intermodel generation, whatever the state of the Auto-

    migrate columns check box, if Rules is selected, the businessrules on the PK are migrated to the FK

    Propagatecolumnproperties

    When you modify the name, the code or the data type of aparent table column that belongs to a reference join, you canuse this option to propagate the change on the correspondingforeign key column

    Default link oncreation: Primarykey

    Reference links Primary key columns to foreign key columnsat creation

    Default link oncreation: User-defined

    Reference not linked. No joins are created

  • 7/27/2019 Daug

    37/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 17

    Option Result

    Defaultimplementation

    Indicates how referential integrity is implemented in thereference. You can choose Declarative if you wish to definereferential integrity for particular references, or you canchoose Trigger if you want referential integrity to beimplemented by triggers

    For more information on referential integrity implementation, seesection Using referential integrity in chapter Building Physical Diagrams.

    At reference creation and during intermodel generation, when the Enforcenon-divergence and the Domain check boxes are selected, the followingeffects occur after intermodel generation:

    Column/Domain Divergence Effect on intermodel generation

    If the column and domain aredivergent in the source model

    Divergence is preserved after intermodelgeneration

    If the column and domain are notdivergent in the source model

    Domain properties are migrated

    For more information on the Auto-reuse and Auto-migrate options, seechapter Building Physical Diagrams.

    PDM extended dependencies

    Extended dependencies are links between PDM objects. These links help tomake object relationships clearer but are not interpreted and checked byPowerDesigner as they are meant to be used for documentation purposesonly.

    You can complement these links by applying stereotypes. Stereotypes areused to define extended dependencies between objects in the PDM.

    You can type stereotypes directly in the Stereotype column of the objectproperty sheet or select a value from the dropdown listbox if you havepreviously defined stereotypes in an embedded or imported extended modeldefinition (.XEM).

    For more information on extended model definitions, see chapterExtended Model Definitions Reference Guide in the Advanced User

    Documentation.

    Enforce selected

  • 7/27/2019 Daug

    38/856

    Defining the PDM environment

    18 PowerDesigner

    PDM database properties

    You can define a database for a PDM.

    For more information on creating a database, see the section Creating adatabase.

    A database definition includes the following properties:Property Description

    Name Name for the database

    Code Code for the database. This code is generated in database scripts

    Comment Descriptive label for the database

    Stereotype Sub-classification used to extend the semantics of an objectwithout changing its structure; it can be predefined or user-defined

    DBMS DBMS for the database

    Options Physical options available in the DBMS

    Script Begin and end scripts that are inserted at the start and end of adatabase creation script

    Rules Business rules for the database

  • 7/27/2019 Daug

    39/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 19

    Defining a PDMYou can create a new PDM, or open an existing PDM. You can also setoptions to define how your model is created or modified, and the type of information that it displays.

    PDM properties

    The Model property sheet displays the definition of the current model. Fromthis property sheet you can modify the model definition.

    A PDM has the following model properties:

    Property Description

    Name Name for the model

    Code Code for the model. This code is generated in database scripts

    Comment Descriptive label for the model

    File name Location of the model file. This box is empty if the model has neverbeen saved

    Author Author of the model. You can insert a name, a space, or nothing.If you insert a space, the Author field in the title box remains

    empty.If you intentionally leave the box empty, the Author field in the

    title box displays the user name from the Version Info page of the model property sheet

    Version Version of the model. You can use this box to display the repositoryversion or a user defined version of the model. This parameter isdefined in the display preferences (Title node)

    DBMS Current DBMS for the model. You can open the property sheet forthe DBMS by clicking the Properties tool at the end of the box

    Database Database name for the model. You can define and select databaseswith new physical properties. If you click the Create tool beside theDatabase box, a confirmation box asks you to commit objectcreation, and the database property sheet appears. You can definethe properties of the new database and click OK

    Defaultdiagram

    Diagram displayed by default when you open the model

  • 7/27/2019 Daug

    40/856

    Defining a PDM

    20 PowerDesigner

    Models for DB2The Database box does not appear in the models targeted for the DB2family as these models support multiple databases in a single model. Formore information, see section Multiple databases in a model in chapterDBMS-specific Features.

    To modify PDM properties:

    1 Select Model Model Properties.or Right click the diagram background and select Properties from thecontextual menu.

    The model property sheet appears.

    2 Type changes to model properties.

    3 Click OK.

    Creating a PDM

    There are several ways to create a PDM:

    Create a new PDM

    Create a new PDM using a template

  • 7/27/2019 Daug

    41/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 21

    Create an PDM using existing elements (reverse engineering a database,importing an ERwin model (.erx), generating from a CDM or OOM,open a version 6 warehouse architect model, etc.

    Creating a PDM using the New model option

    When you create a new PDM using the New model option, you have todefine the following:

    Select a DBMS

    Select a diagram type

    In PowerDesigner, the current DBMS is a text file in XML format thatcontains all the SQL syntax and specifications for an actual DatabaseManagement System.

    PowerDesigner has a DBMS definition for each supported database. TheseDBMS definition files are stored in the DBMS Library directory in thePowerDesigner path. Each DBMS definition file has the extension .XDBwhich signifies XML Database File. You can customize your DBMSdefinition.

    For more information on customizing your DBMS definition, seechapter DBMS Reference Guide in the Advanced User Documentation .

    When you create a PDM, you can connect to a DBMS in one of the followingways:

    DBMS Description

    Share Current DBMS for the PDM constantly refers to the DBMSdefinition file stored in the DBMS library. Any modifications madeto the DBMS are shared by the PDM

    Copy Current DBMS for the PDM is a unique copy of the DBMS

    definition file stored in the DBMS library. The current DBMS isindependent of the original DBMS definition file so modificationsmade to the DBMS definition file in the DBMS library are notavailable to the PDM. The copied DBMS definition is saved with thePDM and can not be used without it

    You also have to select the type of the first diagram in the new model. TheFirst Diagram dropdown listbox lets you select one of the followingdiagrams:

    Physical diagram to define the actual physical structure of the database

    DBMS selection

    Diagram selection

  • 7/27/2019 Daug

    42/856

    Defining a PDM

    22 PowerDesigner

    Multidimensional diagram to define the multidimensional structure of the database

    The first type of diagram selected remains in memory: the next time youcreate a new model, the same type of diagram will appear in the FirstDiagram dropdown listbox.

    To create a new PDM using the New model option:

    1 Select File New to display the New dialog box.

    2 Select Physical Data Model in the list of model types.

    3 Select the New model radio button in the upper right part of the dialogbox.

    4 Select a DBMS from the DBMS dropdown listbox of the General page.

    5 Select either Share or Copy.

    6 Select the type of the first diagram in the First diagram dropdownlistbox.

    7 If you want to attach one or more extended model definitionsto the model, click the Extended Model Definition tab, and select theextended model definitions of your choice.

    For more information on attaching extended model definitions to amodel, see section PDM extended model definitions.

    8 Click OK.

    A new PDM is created in the Workspace.

  • 7/27/2019 Daug

    43/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 23

    9 Select Model Model Properties.or Right-click any empty space in the diagram window and selectProperties from the contextual menu.

    The model property sheet appears.

    10 Type a model name and model code.

    11 Click OK.

    Demo exampleDemo models are available in the Examples directory.

    Creating a PDM using the New model from template option

    To create a new PDM using the New model from template option:

    1 Select File New to display the New dialog box.

    2 Select Physical Data Model in the list of model types.

    3 Select the New model from template radio button in the upper right partof the dialog box to display the Template page.

    4 Select a model template from the list.

  • 7/27/2019 Daug

    44/856

    Defining a PDM

    24 PowerDesigner

    List of templatesYou can select user-defined model templates (use the Change User-Defined Model Templates Folder tool to specify the user templatesfolder) and copy some existing models as model templates using theCopy Model to User-Defined Model Templates Folder tool.

    For more information on model templates, see section Creating amodel in chapter Managing Models, in the General Features Guide .

    5 Click OK.

    A new PDM is created in the Workspace.

    6 Select Model Model Properties.or Right-click any empty space in the diagram window and selectProperties from the contextual menu.

    The model property sheet appears.

    7 Type a model name and model code.

    8 Click OK.

    Opening an existing PDM

    A Physical Data Model has the file extension .PDM.

    If PowerDesigner cannot find the DBMS attached to the Physical Data Modelyou want to open, the Choose DBMS dialog box appears to let you selectanother DBMS to attach to the model. You can select the DBMS from theDBMS dropdown listbox.

    To open an existing PDM:1 Select File Open to display a standard open file dialog box.

    2 Select a file with the .PDM extension.

    3 Click Open.

    The model appears in the Browser and diagram opens in the diagramwindow.

    Choose DBMS

  • 7/27/2019 Daug

    45/856

    Chapter 1 Physical Data Model Basics

    PDM User's Guide 25

    Detaching a PDM from the workspace

    You can detach a PDM from a workspace. When a PDM is detached from aWorkspace its node is removed from the Browser and it is no longer definedin the workspace, but the file is not deleted from your operating environment.

    To detach a PDM from a workspace:1 Right-click the PDM node in the Browser and select Detach From

    Workspace from the contextual menu.

    A confirmation box asks if you want to save the PDM.

    2 Click Yes if you want to save modifications to the PDM.Select or browse to a directory.Type a name for the file and click the Save button.or Click No if you do not want to save modifications to the file.

    The PDM is removed from the workspace.

    Saving and closing a PDM

    You save a PDM by selecting File Save.

    You close a PDM by selecting File Close.

    Archiving a PDM

    Archived models store all constraint names without making a differencebetween user defined and calculated constraints. These models are used withthe modify database feature.

    You can archive a PDM with the .apm file extension, using the followingmethods:

    Save a PDM as an archived model

    Automatically archive PDM after database creation

    To archive a PDM:

    Select File Save As, select Archived PDM (bin) or Archived PDM(xml) in the Save As Type dropdown listbox, and click Save.or

  • 7/27/2019 Daug

    46/856

    Defining a PDM

    26 PowerDesigner

    Select Database Generate Database, click the Options tab, select theAutomatic Archive check box in the After Generation groupbox, andclick OK.

    Creating a database

    You can create a database for the model from the model property sheet.

    To create a database:

    1 Select Model Model Properties to display the model property sheetappears.

    2 Click the Create tool beside the Database box.

    A confirmation box appears asking you to commit the creation of theobject.

    3 Click Yes.

    The database property sh