ODBC Reporting Guide
ODBC Reporting Guide
Access the CA Support online registration site to register for product support.
For your convenience, CA Technologies provides easy access to "One Stop" support for
all editions of CA ERwin Data Modeler, and includes the following:
■ Online and telephone contact information for technical assistance and customer
services
■ Information about user communities and forums
■ Product and documentation downloads
■ CA Support policies and guidelines
■ Other helpful resources appropriate for your product
For information about other Home Office, Small Business, and Enterprise CA
Technologies products, visit http://ca.com/support.
Provide Feedback
Visit www.erwin.com to get up-to-date news, announcements, and events. View video
demos and read up on customer success stories and articles by industry experts.
Contents
Chapter 1: Introduction 7
Query Tool ..................................................................................... 8
Chapter 3: Schemas 17
Exposing Data ................................................................................. 17
Changes to Column Names....................................................................... 17
M0 Schema ................................................................................... 18
Tables .................................................................................... 18
Functions ................................................................................. 24
M1 Schema ................................................................................... 31
Tables .................................................................................... 31
EM0 Schema .................................................................................. 41
Tables .................................................................................... 42
EM1 Schema .................................................................................. 43
Tables .................................................................................... 43
AL Schema .................................................................................... 46
Tables .................................................................................... 46
Functions ..................................................................................... 50
TRAN() .................................................................................... 51
Contents 5
Subject Area Membership ....................................................................... 57
Model UDP Definitions .......................................................................... 57
Objects Using a Default Name .................................................................... 58
Non-Subtype Relationships ...................................................................... 58
All Objects Created During a Modeling Session ...................................................... 58
All Objects Deleted During a Modeling Session ...................................................... 58
All Objects Modified During a Modeling Session ..................................................... 58
All Objects and Properties Modified During a Modeling Session ........................................ 59
Entities Not Having Primary Key Columns ........................................................... 59
Migrated Physical Attributes ..................................................................... 60
Oracle Model Object Types ...................................................................... 60
Chapter 1: Introduction 7
Query Tool
Query Tool
Any ODBC-compliant tool can be used to communicate with this component, such as a
banded report writer, spreadsheet program, or ad hoc query tool. This includes Business
Objects™ Crystal Reports® 2008, which is installed with CA ERwin DM. You also can use
the built-in query tool with CA ERwin DM. To launch it, click Query Tool on the Tools
menu.
The following illustration demonstrates how CA ERwin DM's Query Tool reports against
CA ERwin DM:
The following illustration demonstrates how Crystal Reports 2008 reports against CA
ERwin DM:
Chapter 1: Introduction 9
Query Tool
The following illustration demonstrates how Microsoft® Office Excel® reports against CA
ERwin DM:
Use the connection mechanism of your query tool to connect to one of these data
sources. No user ID or password is required by CA ERwin DM.
If you have multiple copies of CA ERwin DM running, the ODBC driver can serve data
from only one instance. By default, this is the first one started. If you want to change
which instance of CA ERwin DM is handling the ODBC connection, first stop the driver on
the one that is running using the Integrations page on the Options dialog, then start the
driver on the second copy of CA ERwin DM from the same place:
For the ERwin Query Tool, use the Connect to ERwin ODBC toolbar item as quick way to
make this connection:
To connect to CA ERwin DM using Microsoft Office Excel 2007, follow this process:
■ Ensure CA ERwin DM is running with a model loaded.
■ Click the Data menu item.
■ Click the From Other Data Sources tool and select the From Microsoft Query option.
You are asked to choose a data source:
■ Select the ERwin_r8_Current data source, click OK in the Login dialog, and you are
connected to CA ERwin DM and ready to start constructing a query. You can either
use the Wizard or click Cancel and answer 'Yes' to "Do you want to continue editing
this query in Microsoft Query?" to get more direct access to SQL.
Exposing Data
Various components of CA ERwin DM expose data using the ODBC driver. Each of these
areas represents itself as a schema. For example, the tables representing information in
the model are in the M0 schema, while the tables representing information from the
Action Log are in the AL schema.
Note: For CA ERwin DM r8, all table names are unique, so it is not necessary to qualify
them with a schema in a query. However, it is possible that future releases of CA ERwin
DM will have tables in one schema with the same name as tables in another schema.
For example, the NAME column for the foreign key attribute becomes
CHILD_ATTRIBUTE_NAME@ and the ID@ column for the parent attribute would be
PARENT_ATTRIBUTE_ID@.
Chapter 3: Schemas 17
M0 Schema
M0 Schema
The M0 schema contains the modeling data in a CA ERwin DM model.
The various classes of objects and properties in a CA ERwin DM model form the
definitions of tables and columns exposed using the ODBC interface. To find the class
names used in CA ERwin DM's metamodel, see the document ERwin Metamodel
Reference. All spaces and periods in class names are replaced with underscores. The
ODBC interface capitalizes the names, but the driver is not case-sensitive. For example,
the Entity class becomes the ENTITY table and the Long_Id property becomes the
LONG_ID column.
Tables
This section describes the tables in the M0 schema.
ABSTRACT_OBJECT Table
The M0 schema contains the ABSTRACT_OBJECT table. This table, based on the
Abstract_Object class, has a row for every object in the model that is not marked as
Tag_Is_Internal. The following table describes the columns in the ABSTRACT_OBJECT
table:
ID@ INTEGER The ID of the object in the model. This is the short ID of an
object, which is unique in the model, but may change from
session to session.
TYPE@ INTEGER The class ID of the object.
OWNER@ INTEGER The ID of the owning object.
NAME VARCHAR The name of the object. For a dual object, this will be the
logical name.
LONG_ID CHAR(67) The long ID of the object. This is the permanent ID
assigned to each object in a CA ERwin DM model.
You can use a query similar to the following to see a list of the types and names of all
objects in the model.
Example: Query for returning the list of types and names of all model objects
Chapter 3: Schemas 19
M0 Schema
The M0 schema also contains a table for every concrete type of object that can be
created in CA ERwin DM, excluding types that are marked as Tag_Is_Internal. For
example, there will be an ENTITY table that holds rows describing Entity objects in the
model, an ATTRIBUTE table that holds rows describing Attribute objects, and so on.
In these tables, each row represents an instance of an object of that type in the model.
There are three columns that are present on each instance of this type of table:
There is also a column for each possible property on the object that has a scalar data
type and is not flagged as Tag_Is_Internal. For example, there will be a NAME column, a
LONG_ID column, and so on. The data types of these columns will depend upon the
underlying data types of the properties represented.
The following table maps the property data types to those exposed using the ODBC
interface:
Size CHAR(23) The string will be formatted as the width and height
components, separated by a period. For example:
20.30
Chapter 3: Schemas 21
M0 Schema
To illustrate this, the ATTRIBUTE table would have columns such as NAME, DEFINITION,
DATATYPE, NULL_OPTION, and so on. You can use a query similar to the following to
determine the names of all the Attribute objects in your model.
Example: Query for returning the list of names of all the Attribute model objects
The M0 schema also contains one table for each type of property that has a vector data
type, excluding properties flagged as Tag_Is_Internal. In these tables, each row
represents a single value in an instance of the property.
There are three columns present on each instance of this type of table. The following
table describes the columns found on all Vector Property type tables:
Chapter 3: Schemas 23
M0 Schema
For example, a Subject_Area object holds a vector property that contains the IDs of all
Entity objects that are members. This property has a class name of
Referenced_Entities_Ref, which becomes the REFERENCED_ENTITIES_REF table. You can
use the following query if you wanted to see the names and types of all members of the
Movie subject area in the eMovies.ERWIN model.
Functions
The M0 schema supports the following scalar functions in addition to the standard
ODBC functions.
IS_DEFAULT
This function evaluates to a single character and is applied to columns that contain
property values. It will evaluate to T if the value in the property is a default value
assigned by CA ERwin DM, otherwise, it will evaluate to F.
For example, when you create a new Validation_Rule object in CA ERwin DM, it is
assigned an application-generated name of the form Validation_Rule_XX where XX is
the ID. A query would show that this is a default name.
Chapter 3: Schemas 25
M0 Schema
If you change the name and re-execute the query, the status changes:
Example: Query for returning the name of an object showing the change in status
from its default
IS_HARDENED()
This function evaluates to a single character and is applied to columns that contain
property values that can be hardened.
Note: CA ERwin DM r8 only allows hardening of name values, so this function only has
meaning when applied to the NAME column and the PHYSICAL_NAME column of the
ATTRIBUTE, DEFAULT, DOMAIN, ENTITY, KEY_GROUP, RELATIONSHIP, and
VALIDATION_RULE tables. Future releases of CA ERwin DM may extend hardening to
more property types.
It will evaluate to T if the value in the property has been hardened, otherwise, it will
evaluate to F.
For example, suppose you use the Name Hardening Wizard to harden the
Physical_Name of all Attribute objects in the eMovies.ERWIN model. The following
query shows the results of the IS_HARDENED() function.
Note: The row restriction is to filter out view columns, which are not type-split from
table columns as of CA ERwin DM r8.
Chapter 3: Schemas 27
M0 Schema
IS_AUTOCALCULATED()
This function evaluates to a single character and is applied to columns that contain
property values. It evaluates to T if the value in the property is in an auto-calculate
state, and to F if it is not.
You can use a query similar to the following to see which Relationship objects in the
model have explicit cardinality set.
Example: Query for returning Relationship objects in the model that have explicit
cardinality set
TRAN()
CA ERwin DM stores a number of property values in an encoded form that is not friendly
for display purposes. Additionally, some properties contain macro code that is expanded
to form a display value. If you retrieve the value from the property directly, you will get
the raw value.
If the TRAN() function is applied to the column, the raw value is translated into a display
value. The result is always a string. If this function is applied to a column that has no
translated value, a string representation of the raw value is returned.
Chapter 3: Schemas 29
M0 Schema
The TRAN() function can also be applied to the TYPE@ column to retrieve an English
version of the type identifier, such as the class name:
M1 Schema
The M1 schema contains the metadata in a CA ERwin DM model.
The various classes of objects and properties in a CA ERwin DM model form the
definitions of tables and columns exposed using the ODBC interface. To find the class
names used in CA ERwin DM's metamodel, see the document ERwin Metamodel
Reference. All spaces and periods in class names are replaced with underscores. The
ODBC interface capitalizes the names, but the driver is not case-sensitive. For example,
the Object_Type class becomes the OBJECT_TYPE table and the Long_Id property
becomes the LONG_ID column.
Several of the table descriptions below indicate the base columns exposed. These
represent the fundamental columns of the table that will be present across various
releases of CA ERwin DM. These tables will also expose columns showing tag values for
the item being described. A tag is a characteristic of an item such as "does it show up in
the Explorer?" (TAG_IS_EXPLORER_SUPPRESSED). Tags can change from release to
release of CA ERwin DM as the needs of the product change. You should consult the
ERwin Metamodel Reference document for a description of the tags for a given release.
Tables
This section describes the tables in the M1 schema.
OBJECT_TYPE Table
The OBJECT_TYPE table contains information about the types of objects permitted in a
CA ERwin DM model. In other words, rows in this table will correspond to tables
exposed by the M0 schema. The following table describes the base columns in the
OBJECT_TYPE table:
ID@ INTEGER The ID of the object in the model. Though this is a short ID,
it never changes.
NAME VARCHAR The name of the type.
LONG_ID CHAR(67) The long ID of the type. This is provided for consistency
with M0.
DEFINITION VARCHAR The definition of the type.
TAG_IS_ABSTRACT CHAR(1) Does the object type represent an abstract object (one that
cannot be created in the model)? Abstract object types are
not exposed by the M0 schema.
Chapter 3: Schemas 31
M1 Schema
TAG_RELEASE_DEPRECATED VARCHAR The release in which the type was deprecated. If the type is
deprecated, but this value is NULL, then the release was
7.0.
TAG_RELEASE_ADDED VARCHAR The release in which the type was added.
You can use a query similar to the following to find the active, physical-only object
types.
PROPERTY_TYPE Table
The PROPERTY_TYPE table contains information about the types of properties permitted
in a CA ERwin DM model. In other words, rows in this table will correspond to columns
on M0 tables (for scalar properties) or to M0 tables (for vector properties). The
following table describes the base columns in the PROPERTY_TYPE table:
ID@ INTEGER The ID of the object in the model. Though this is a short ID,
it never changes.
NAME VARCHAR The name of the type.
LONG_ID CHAR(67) The long ID of the type. This is provided for consistency
with M0.
DEFINITION VARCHAR The definition of the type.
TAG_IS_INTERNAL CHAR(1) Is the object type marked as Internal? Internal types are
not exposed by the M0 schema.
TAG_IS_DEPRECATED CHAR(1) Has this type been deprecated?
TAG_IS_LOCALLY_DEFINED CHAR(1) Is this metadata defined in the model? For example, is this
a UDP?
DATA_TYPE INTEGER The data type of the property.
Chapter 3: Schemas 33
M1 Schema
You can use a query similar to the following to find all the user-defined properties
(UDPs) in a model.
ASSOCIATION_TYPE Table
ID@ INTEGER The ID of the object in the model. Though this is a short ID,
it never changes.
NAME VARCHAR The name of the type.
LONG_ID CHAR(67) The long ID of the type. This is provided for consistency
with M0.
DEFINITION VARCHAR The definition of the type.
TAG_IS_DEPRECATED CHAR(1) Has this type been deprecated?
TAG_DEPRECATION_LEVEL INTEGER A value of 2 indicates that the type is still in the
metamodel, but is no longer active. A value of 3 indicates
the type is no longer in the metamodel. A value of -1
indicates the type is for a future release.
TAG_RELEASE_DEPRECATED VARCHAR The release in which the type was deprecated. If the type is
deprecated, but this value is NULL, then the release was
7.0.
TAG_RELEASE_ADDED VARCHAR The release in which the type was added.
PARTICIPATING_OBJECT_REF INTEGER The ID of the object type instance.
Chapter 3: Schemas 35
M1 Schema
You can use a query similar to the following to find all the properties that may be
applied to a model object.
Example: Query for returning all the properties that may be applied to a model object
AGGREGATION_TYPE Table
ID@ INTEGER The ID of the object in the model. Though this is a short
ID, it never changes.
NAME VARCHAR The name of the type.
LONG_ID CHAR(67) The long ID of the type. This is provided for consistency
with M0.
DEFINITION VARCHAR The definition of the type.
TAG_IS_DEPRECATED CHAR(1) Has this type been deprecated?
You can use a query similar to the following to show what objects are owned directly by
the model.
Example: Query for returning a list of objects that are directly owned by a model
Chapter 3: Schemas 37
M1 Schema
ABSTRACT_TYPE Table
The ABSTRACT_TYPE table contains rows for each entry in the OBJECT_TYPE and the
PROPERTY_TYPE table. The following table describes the columns in the
ABSTRACT_TYPE table:
ID@ INTEGER The ID of the object in the model. Though this is a short
ID, it never changes.
You can use a query similar to the following to show all the class names that are
associated with the types used to define the M0 schema.
Example: Query for returning a list of all the class names associated with the types
used to define the M0 schema
The CATEGORY_TYPE table exposes the category definitions found in CA ERwin DM's
metamodel. The CATEGORY_MEMBER table defines the members of the categories.
Categories are collections of object and/or property types that are similar in some way
significant to CA ERwin DM. The following table describes the columns in the
CATEGORY_TYPE table:
TAG_RELEASE_DEPRECATED VARCHAR The release in which the type was deprecated. If the
type is deprecated, but this value is NULL, then the
release was 7.0.
TAG_RELEASE_ADDED VARCHAR The release in which the type was added.
Chapter 3: Schemas 39
M1 Schema
You can use a query similar to the following to show the members of the various
categories as they are used in the Action Log Metamodel Filter dialog.
EM0 Schema
The EM0 schema exposed by CA ERwin DM is an extension to the M0 schema exposed
by the modeling engine. The M0 schema exposes the data in a CA ERwin DM model,
including the dual objects-those objects that may exist simultaneously in both the
logical and physical models.
Some of these objects may have their presence in one model or the other blocked. For
example, an Entity might be marked as Is_Logical_Only. Alternatively, for historical
reasons, CA ERwin DM maintains hidden copies of an Attribute when attribute
unification occurs. For example, the hidden copy of an Attribute unified on the logical
side would have the Hide_In_Logical set.
This schema exposes views of these types of objects that filter out the instances that are
hidden.
Chapter 3: Schemas 41
EM0 Schema
Tables
The following table lists the tables exposed by EM0, as well as the underlying M0 table
to which it corresponds.
For the other tables exposed by this schema, the EM0 table will be identical to the M0
table except that objects having the Is_Physical_Only or Hide_In_Logical properties set
will not occur in the logical versions of the table, and objects having the Is_Logical_Only
or Hide_In_Physical properties set will not occur in the physical versions of the table.
MV_LOGICAL_ATTRIBUTE@ ATTRIBUTE
MV_PHYSICAL_ATTRIBUTE@ ATTRIBUTE
MV_LOGICAL_DEFAULT@ DEFAULT
MV_PHYSICAL_DEFAULT@ DEFAULT
MV_LOGICAL_DOMAIN@ DOMAIN
MV_PHYSICAL_DOMAIN@ DOMAIN
MV_LOGICAL_ENTITY@ ENTITY
MV_PHYSICAL_ENTITY@ ENTITY
MV_LOGICAL_KEY_GROUP@ KEY_GROUP
MV_PHYSICAL_KEY_GROUP@ KEY_GROUP
MV_LOGICAL_RELATIONSHIP@ RELATIONSHIP
MV_PHYSICAL_RELATIONSHIP@ RELATIONSHIP
MV_LOGICAL_VALIDATION_RULE@ VALIDATION_RULE
MV_PHYSICAL_VALIDATION_RULE@ VALIDATION_RULE
MV_VISIBLE_ATTRIBUTE@ ATTRIBUTE
EM1 Schema
The EM1 schema exposed by CA ERwin DM is an extension to the M1 schema exposed
by the modeling engine. The M1 schema exposes the entire metamodel, including the
raw information about what objects and properties apply to what databases. However,
the raw format of the database information can be difficult to interpret. The EM1
schema exposes views of that same information in a more readable format.
Tables
This section describes the tables in the EM1 schema.
TARGET_DBMS Table
MIN_VERSION INTEGER The earliest version for which the type is defined. The
format is the version number multiplied by 1000. For
example, Version 7.2 would be 7200. A value of zero
indicates all versions less than MAX_VERSION.
MAX_VERSION INTEGER The latest version for which the type is defined. The
format is the version number multiplied by 1000. For
example, Version 7.2 would be 7200. A value of 999000
indicates all versions greater than MIN_VERSION.
Chapter 3: Schemas 43
EM1 Schema
You can use a query similar to the following to see which CA ERwin DM DBMS targets
define synonym objects.
DBMS-Specific Tables
The information from TARGET_DBMS is broken down into DBMS-specific tables to make
some queries easier. Each of these tables is named in the form XX_DBMS where XX is
the name of the DBMS.
MIN_VERSION INTEGER The earliest version for which the type is defined. The
format is the version number multiplied by 1000. For
example, Version 7.2 would be 7200. A value of zero
indicates all versions less than MAX_VERSION.
MAX_VERSION INTEGER The latest version for which the type is defined. The
format is the version number multiplied by 1000. For
example, Version 7.2 would be 7200. A value of
999000 indicates all versions greater than
MIN_VERSION.
Chapter 3: Schemas 45
AL Schema
You can use a query similar to the following to determine the objects that are defined
for Oracle.
Example: Query for returning a list of the objects defined for Oracle
AL Schema
This schema exposes the contents of the Action Log in CA ERwin DM. Querying these
tables allows you to retrieve the same type of information that is found in the Activity
Summary file that can be generated when a CA ERwin DM model is closed.
Tables
This section describes the tables in the AL schema.
CREATED Table
This table exposes all the objects that were created during the session. The following
table describes the columns in the CREATED table:
ID@ INTEGER The ID of the object in the model. This is the short ID of an
object, which is unique in the model, but may change from
session to session.
TYPE@ INTEGER The class ID of the object.
NAME VARCHAR The name of the object. For a dual object, this will be the
logical name.
OWNER_PATH VARCHAR A period-separated list of the ownership chain for the
object.
You can use a query similar to the following to see all the objects created in the session.
Example: Query for returning a list of all the objects created in a modeling session
Chapter 3: Schemas 47
AL Schema
DELETED Table
This table exposes all objects that were deleted during the session. The following table
describes the columns in the DELETED table:
ID@ INTEGER The ID of the object in the model. This is the short ID of
an object, which is unique in the model, but may
change from session to session.
TYPE@ INTEGER The class ID of the object.
NAME VARCHAR The name of the object. For a dual object, this will be
the logical name.
OWNER_PATH VARCHAR A period-separated list of the ownership chain for the
object.
You can use a query similar to the following to see all the objects deleted in the session.
Example: Query for returning a list of all the objects deleted in a modeling session
The MODIFIED table exposes all objects that were modified during the session. The
PROPERTIES table lists the old and new values for the changed properties on those
objects. The following table describes the columns in the MODIFIED table:
ID@ INTEGER The ID of the object in the model. This is the short ID of
an object, which is unique in the model, but may change
from session to session.
TYPE@ INTEGER The class ID of the object.
NAME VARCHAR The name of the object. For a dual object, this will be the
logical name.
OWNER_PATH VARCHAR A period-separated list of the ownership chain for the
object.
ID@ INTEGER The ID of the object in the model. This is the short ID of
an object, which is unique in the model, but may change
from session to session.
TYPE@ INTEGER The class ID of the property modified.
Chapter 3: Schemas 49
Functions
You can use a query similar to the following to see all changed properties during a
session.
Example: Query for returning a list of all the properties that changed during a
modeling session
Functions
This section describes the functions used to retrieve property values.
TRAN()
The TRAN() function can be applied to the TYPE@ column to retrieve an English version
of the type identifier, such as the class name.
Chapter 3: Schemas 51
Appendix A: Useful Queries
The following queries may be useful as written, or they can be used as the starting point
for developing a query of your own.
SELECT NAME
FROM EM0.MV_LOGICAL_ENTITY@
ORDER BY 1
Example: Query for returning a list of the qualified names for physical entities (tables)
for target servers that use separate schema objects, such as SQL Server 2005
Example: Query for returning the logical and physical names for all attributes, filtering
out unified attributes
Logical-Only Attributes
Example: Query for returning the names of logical-only attributes
Domain Usage
Example: Query for returning information on domain usage
Note: This report will contain domains that are used indirectly through domain
inheritance.
SELECT NAME
FROM DOMAIN
WHERE ID@ NOT IN (SELECT PARENT_DOMAIN_REF FROM ATTRIBUTE)
Example: Query for returning a list of domains not used by attributes, excluding
domains that are used by other domains
SELECT NAME
FROM DOMAIN
WHERE ID@ NOT IN
(
SELECT PARENT_DOMAIN_REF FROM ATTRIBUTE
UNION
SELECT PARENT_DOMAIN_REF FROM DOMAIN
)
SELECT NAME
FROM M1.PROPERTY_TYPE
WHERE TAG_IS_LOCALLY_DEFINED = 'T'
SELECT NAME
FROM M0.ABSTRACT_OBJECT
WHERE IS_DEFAULT(NAME) = 'T'
Non-Subtype Relationships
Example: Query for returning a list of non-subtype relationships
SELECT NAME
FROM M0.ENTITY
WHERE ID@ NOT IN
(
SELECT E.ID@
FROM M0.ENTITY E INNER JOIN M0.KEY_GROUP KG
ON E.ID@ = KG.OWNER@
INNER JOIN M0.KEY_GROUP_MEMBER M
ON KG.ID@ = M.OWNER@
WHERE KG.KEY_GROUP_TYPE = 'PK'
)
SELECT TRAN(A.TYPE)
FROM EM1.MV_ORACLE_DBMS A INNER JOIN M1.OBJECT_TYPE B
ON A.TYPE = B.ID@
WHERE B.TAG_IS_ABSTRACT IS NULL OR B.TAG_IS_ABSTRACT = 'F'
ORDER BY 1