Structure Compare Task Template
An XDM structure compare task template is designed to compare structures in the source environment with corresponding structures in the target environment.
When a structure compare task is executed, it examines the source and target environment by processing selection rules, exclude rules and mapping rules. The structures of the source and target tables are compared in order to determine structural differences between the source and target objects. If desired, a structure compare task can generate DDL statements with which the target environment can be modified, so that it conforms to the source environment.
Permissions
Task Templates have specific permissions to manage user access. The table below displays the available permissions and their purposes.
For more details about the concept of XDMs permission management refer to Permission Management.
Permission |
Description |
|---|---|
ADMINISTRATION |
Specifies that the grantee can grant and revoke permissions to and from other users. A user that creates an object automatically receives the |
DELETE |
Specifies that the grantee can delete objects of the selected types. |
DIAGNOSE |
This permission controls access to diagnostic data of a task execution. The diagnostic data consists of the stages, their outputs and the batch reports. |
EXECUTE |
Specifies that the grantee may execute the object, or schedule the object for later execution. This permission only applies to objects that are executable, i.e. tasks, task templates, workflows, workflow templates, and data shops. |
READ |
Specifies that the grantee has read permission on the object. The grantee is able to see the object in lists and can see all of the object’s details, such as rules or access permissions. In addition, the grantee can reference this object.
For example, a user who has |
WRITE |
Specifies that the grantee has the permission to change the settings and attributes of an object. This also includes modifying any rule lists that might be associated with the object (for example, the selection rules of a task template). |
Properties
The table below documents the available properties for task templates. The 'name' column displays the property name as it can be used in Groovy and Java Scripts.
Name |
Type |
Default |
Description |
||||
|---|---|---|---|---|---|---|---|
|
abortOnDifference |
Boolean |
false |
Specifies whether structure comparison task executions should abort, if structural differences between the source and target tables are detected. Therefore, no DDL will be executed. When set to true, a structure comparison execution will abort with Return Code 8, if structural differences are detected. In this case DDL will be neither generated nor executed. |
||||
|
comparableFields |
ComparableField |
n/a |
The property contains a list of all comparable fields. The fields can be chosen from all connection types that can be used in the comparison of the selected objects. The field names correspond to the catalog entries for the relevant database type. Each field has a checkbox indicating whether it has been selected for comparison. |
||||
Delete execution files on success deleteExecutionFilesOnSuccess |
Boolean |
false |
Specifies if working files of a task execution should be deleted in case of a successful task execution. This reduces the required space for a task and should therefore prevent space problems on the server when many tasks exist. |
||||
|
description |
String |
n/a |
An optional description for this object. The description can contain multiple lines to give more context on the configured object. The description is not used in a technical context. |
||||
|
displayName |
String |
n/a |
Specifies the name of the object. The name is used to display and identify the object in lists. The name can contain any valid UTF-8 characters. |
||||
|
dropOption |
Enum |
NOTHING |
This option specifies how XDM handles the target tables of a task during structure comparison.
|
||||
|
dropRestrictOnDrop |
Boolean |
false |
Within Db2, with the attribute |
||||
|
executionPlatform |
String |
default |
This property defines whether and on which platform the Dataflow server is being built for a task or workflow execution. The property on the template is overwritten by the property on the task or workflow. |
||||
|
executionRetentionPeriod |
String |
-1 |
Specifies how long executions are kept for the specific task or workflow.
If an execution is older than the specified retention period, the XDM service will remove it.
If the executions should not be deleted automatically, the retention period must be set to -1. Otherwise, the input must start with
A detailed description of the period syntax can be found here. |
||||
|
generateAlias |
Boolean |
true |
If you copy a source table or sequence you can specify whether any aliases for these source objects should be generated in the DDL for the target as well. If the property is set to true, DDL for aliases will be generated and executed during task execution. |
||||
|
generateComment |
Boolean |
true |
If you copy a source table you can specify whether any comments for this source table should be generated in the DDL for the target as well. If the property is set to true, DDL for comments will be generated and executed during task execution. |
||||
|
generateDdl |
Boolean |
false |
Defines whether a structure compare task should generate and execute DDL on the target database. If the property is set to true, DDL will be generated and executed during task execution. |
||||
|
generateForeignKey |
Boolean |
true |
If you copy a source table you can specify whether the foreign keys for this table should be generated in the DDL for the target as well. If the property is set to true, DDL for foreign keys will be generated and executed during task execution. |
||||
|
generateGrant |
Boolean |
true |
If you copy a source table you can specify whether the grants for this table should be generated in the DDL for the target as well. If the property is set to true, DDL for grants will be generated and executed during task execution. |
||||
|
jdbcProfiling |
Boolean |
false |
Activate the performance supervision in the associated task template (all task types are supported).
If this option is activated certain warnings in the task logs will be activated and profiling statistics for JDBC queries are logged.
They are available through a task execution export in the task folder |
||||
|
logLevel |
Loglevel |
INFO |
Controls the granularity of the log messages for the XDM task issued directly by XDM. The number of log messages decreases in the following order: Trace → Info → Warning → Error
It is also possible to overwrite the log level in specific program parts. This can be done by adding the prefix Possible values are:
|
||||
|
sourceConnection |
Connection |
n/a |
Specifies the connection that is used as source connection in the task. A source connection must be set in either the task template or the task. If it is set in both, the connection set in the task is used. |
||||
|
tags |
Tag |
n/a |
Contains the tags that apply to this object. These tags can be used in the search to find objects quickly and effortlessly. |
||||
|
targetConnection |
Connection |
n/a |
Specifies the connection that is used as the target in the task. A target connection must be set in either the task template or the task. If it is set in both, then the connection set in the task is used. |
||||
|
taskExecutionReport |
TaskExecutionReport |
n/a |
This list defines which reports are created at the end of an execution and are displayed in the task execution. The list includes all defined reports to which the current user has READ access. The selected reports are generated at the end of a task or workflow execution.
|
||||
|
useDelimiter |
Boolean |
true |
Specifies whether a double quote delimiter should be used in DDL and SQL statements to identify objects such as schemas, tables, etc. Unquoted identifiers are case-insensitive. This means that they will recognize customer, Customer, and CUSTOMER as the same object. However, quoted identifiers are case-sensitive. This leads to treating "CUSTOMER" and "customer" as entirely different objects. You should keep in mind that XDM uses double quote delimiters by default.
Turning this feature off can lead to usability issues.
If you decide not to use double quote delimiters, you should be aware of how the database you are dealing with handles identifiers.
For example, Db2 converts unquoted identifiers to uppercase, whereas PostgreSQL converts them to lowercase.
Therefore, if you want to select a table named You should avoid mixing tasks with and without double quote delimiters. |
||||
Use mapped selection rules for target useMappedSelectionRulesForTarget |
Boolean |
false |
If enabled, the target objects will be fetched by using the defined selection and exclude rules with applied mapping rules. This allows to fetch tables in the target that match the rules, but do not have a corresponding source table. When using drop mode 'Drop and recreate', the additional tables will also be dropped. |
||||
|
usingAliasedTables |
Boolean |
false |
This property enables a task to use an alias on a table as a replacement for this table. This is useful in the following scenario: You have defined a uniform application model that names tables in the rules. In a certain environment the tables are named differently and have an alias for the original name. Then XDM creates a virtual table object in the task process under the name of the alias, and the column list of the underlying table.
|
||||
|
usingViewedTables |
Boolean |
false |
Using viewed tables controls when views should be handled like tables.
In the event that a view references another view or an alias, XDM will follow the chain of references to a depth of 5 steps by default.
You can control the selection depth by setting a custom parameter Views can be used as a source in most cases, even if they are based on multiple tables or using functions to modify column values. For target usage, only views can be used that are based on a single table and reflect the columns without modifying any value. Please refer to the definition on deletable views, insertable views and updatable views of the database system documentation. When inserting on a view, the view will receive the DELETE, UPDATE and INSERT statements and the database system evaluates if the operation is permitted.
|
Actions
The available actions are described below. Some actions apply to the list, while others are specific to selected task templates.
List Actions
The following actions are available on the task templates list. If the action is disabled a tooltip will provide the exact reason for the deactivation. The required permissions are described in detail for each action.
-
Bulk Create Permission
-
Bulk Delete
-
Bulk Export
-
Create
-
List History
Create a new permission on the selected objects. Shows in the result list whether the permission could be granted on the respective object. Only these permissions can be granted that are existing on the underlying object.
A permission in the result list can have three different states, these are:
- CREATED
-
The permission successfully granted on the object.
- MERGED
-
The granted permission already exists on the object and merged with the new permission.
- SKIPPED
-
The permission could not be granted, because of missing administration permission on the object.
The following permissions are required on the list:
-
ADMINISTRATION
-
READ
Delete the selected objects.
The following options are available:
- Cascade
-
Recursively delete depending objects.
|
When using cascade, dependent objects are deleted first also with cascade enabled. Thus, a cascade deletion is a recursive function that deeply searches for dependent objects and deletes them first. There is only a confirmation for the first object. The dependent objects are deleted without confirmation but only when the user has the DELETE permission. This feature is only available in development mode. More information about development mode can be found in the chapter User Settings. It should be used with caution. |
An object in the result list can have two different states, these are:
- DELETED
-
The object could be deleted.
- NOT_DELETED
-
The object could be not deleted. This may be because the executing person does not have a delete permission on the object or the object is still referenced by others. A detailed reason can be determined with the help of the error message. If the object is still in use, these objects are also displayed.
The following permissions are required on the list:
-
DELETE
-
READ
Exports the selected objects.
- YAML
-
Generates a YAML file containing all the object’s settings. The user has the option to download the export file, or to paste the content in the import dialog. The YAML export is particularly suitable for importing the exported objects again via the XDM UI.
- ZIP
-
This export writes several individual YAML-files. Each YAML-file is stored in a directory according to its type. For example, when exporting a native table backup task template named 'A backup template', a YAML-file 'A backup template.yaml' is created inside the directory /TaskTemplate/native-table-backup-task-template/ of the ZIP-file. This kind of export is suitable for usage in git-repositories together with XDM’s configuration as code feature.
Related and dependent objects can optionally be included in the export. The export dialog has the following options:
- Include dependent objects
-
Dependent objects only belong to the exported object like rules and tasks.
- Include permissions
-
Permissions of each exported object, only when the object supports permissions. Some objects like rules don’t have permissions.
- Include referenced objects
-
Referenced objects exist by their own and are used in the exported object like connections and environments.
- Include objects that depend on referenced objects
-
Also include the dependent objects of the referenced objects. E.g. the rules of a modification set or the rules in an application model version.
| Objects on which the user does not have READ permission are not exported. This includes dependent and referenced objects. However, the reference to an object will be exported. For example a connection object would refer to the credential, even if the user does not have READ permission on the credential. The definition of the credential object itself will not be part of the export file. This can lead to issues during the import, because the connection cannot be created without an existing credential. |
The following permissions are required on the list:
-
READ
Creates a new object in the current list. Depending on the object type either a popup dialog is shown for the most important settings, or the complete object is shown in edit mode. The dialog provides the option to create the object and remain in the current list or to switch to the newly created object in edit mode to perform further changes.
The following permissions are required on the list:
-
CREATE
The history list tracks all modifications made to objects within it. A new record is added each time an object is created, edited, or deleted. A record indicates who made the change, which object was affected, and when the change was made.
For more information about the concept of the history refer to the history concepts.
The following permissions are required on the list:
-
READ
Object Actions
The following actions are available on specific task templates. In order to execute the action, the user must possess the necessary permissions for the object. The permissions required for each action are described individually. If the user does not have these permissions, the action will be disabled and the tooltip will provide the exact reason for the deactivation.
-
Check
-
Delete
-
Duplicate
-
Edit
-
Event List
-
Export
-
Object History
-
Permission Check
-
Usage
-
Uses
This action validates the object and its dependencies, reporting configuration errors that could cause issues during task or workflow execution. The validation will cascade through the child objects of the checked objects and objects referenced by them.
For instance, if an installed application of an environment is checked, the check will process the application model, the specified version, the connection, modification sets, and involved modification methods. If an object has rules, all active rules will be checked. The modeling connection and version, including their modification sets and methods, will also be checked. Deactivated objects will not be included in recursive checks, but can be checked individually if the check is executed on the object itself.
Checks often require additional information from the context of the objects being checked, such as necessary connections or custom parameter values. The check will gather information from the objects being checked and use it to perform checks on child objects. Any required additional information must be provided before the check begins. The check queries the user to provide these missing information.
- Database object checks
-
For all rules which reference database objects such as tables, columns, etc, the check verifies that the those objects exist in the database system. If a connection can be inferred from the context, then this connection is used. If no connection is available in the context, it must be specified before the check is executed.
- Connection checks
-
For objects which configure access to external systems, such as connections or storage locations, the configuration check verifies that access can be established using the given credentials. Furthermore, additional operations on database connections are performed to check whether the credential user has the necessary authorization to access relevant database objects. In particular, the credential user’s permission to read source tables and write to target tables is verified. Similarly, for storage locations the check verifies that the credential user has permission to write to the working directory.
- Code checks
-
For all entities containing code segments, such as modification methods or condition scripts, the syntax for the code is checked. This does not check, however, whether at run time all necessary variables are likely to be available.
The following permissions are required:
-
READ
Delete the object. If the object is still used by another entity, an error message is displayed, and the object is not deleted. The delete operation must be confirmed in a separate popup.
The following options are available:
- Cascade
-
Recursively delete depending objects.
|
When using cascade, dependent objects are deleted first also with cascade enabled. Thus, a cascade deletion is a recursive function that deeply searches for dependent objects and deletes them first. There is only a confirmation for the first object. The dependent objects are deleted without confirmation but only when the user has the DELETE permission. This feature is only available in development mode. More information about development mode can be found in the chapter User Settings. It should be used with caution. |
The following permissions are required:
-
DELETE
-
READ
Will create an exact copy of the current object with a different display name in the same list. Users can decide whether they want to copy child objects like rules, permissions or tasks. It is only possible to select complete classes of objects and not to select individual child objects. Copied child-objects will preserve their display name. The default is to copy all child objects.
The following permissions are required:
-
CREATE
-
READ
Opens the current entity in edit mode.
The following permissions are required:
-
READ
-
WRITE
This list shows all registered events for the object. It includes events that are specific to the object, or for that type.
The following permissions are required:
-
READ
This action allows to export XDM objects in different formats in order to import them via export or CasC in another environment.
Refer to configuration of export for more information.
Related and dependent objects can optionally be included in the export. The export dialog has the following options:
- Include dependent objects
-
Dependent objects only belong to the exported object like rules and tasks.
- Include permissions
-
Permissions of each exported object, only when the object supports permissions. Some objects like rules don’t have permissions.
- Include referenced objects
-
Referenced objects exist by their own and are used in the exported object like connections and environments.
- Include objects that depend on referenced objects
-
Also include the dependent objects of the referenced objects. E.g. the rules of a modification set or the rules in an application model version.
- Include implicit created objects
-
Implicit created objects are tasks or workflows which were automatically created for execution. These objects won’t be exported by default, but can be included by setting this flag. When exporting implicit objects, make sure that the
Include dependent objectsflag is also enabled.
|
Objects on which the user does not have For example a connection object would refer to the credential, even if the user does not have |
The following permissions are required:
-
READ
The history displays all changes made to the respective XDM object, including any changes made to its rules.
Each change record includes information about the operation performed (e.g. CREATE, UPDATE, DELETE), the timestamp, and the user responsible for the change.
For more information about the concept of the history refer to the history concepts.
The following permissions are required:
-
READ
The check verifies that the current user has the authorization to access the object. The check can also be performed for a specific user or role, if needed. By default, the check is performed using the current user’s credentials. It is then applied to child and referenced objects.
Additional permission checks are applied when these can be inferred from the context in which the check was started. For example, if the check is performed on a table copy task, the referenced source and target connections are checked to determine whether the given identity has source or target usage permission respectively.
The following permissions are required:
-
READ
The Usage List shows all objects that refer to the current object. It provides an overview of the relationships and makes it easy to track these relationships.
The following permissions are required:
-
READ
The Uses List shows all objects that the current object uses. It provides an overview of the relationships and makes it easy to track these relationships.
The following permissions are required:
-
READ
License Options
This object is available if the following license option is enabled:
-
TASK_TYPE:STRUCTURE_COMPARE_TASK
The object is also available if the license package is at least: ESSENTIAL.
Comparable Fields
Comparable Fields defines which attributes of an object should be compared in a structure compare task. It contains all the fields of the catalog tables that can be compared using XDM. In this tab Comparable Fields, it is possible to choose which attributes should be compared. All chosen Properties will be compared in the task.
A structure compare with icebox task has an appropriate default field selection list for all database types that are supported. This default list is selected in the Comparable Fields tab when creating a new task template.
If no field is selected, the task will only check if the chosen objects exist in the target database.
Prerequisites
To complete the configuration of an XDM structure compare task template you have to set up a connection and credential.
Required permissions
Users and Groups
The following users are defined for a structure compare task:
-
Source database user, defined in the credential of the source connection and
-
Target database user, defined in the credential of the target connection.
Authorization for the source database user
-
SELECTauthority for the database catalog
Additional requirement for DB2 LUW
-
SELECTauthority for the administrative viewSYSIBMADM.TBSP_UTILIZATIONto determine the sizes of all tablespaces involved (only necessary if tablespace sizes are compared) -
System monitor authority (
SYSMON) to obtain additional useful information from the database catalog (optional, but recommended)
Authorization for the target database user
-
SELECTauthority for the database catalog -
Create database objects/Execute DDL (only for creating new database objects)
Implicit objects
When a structure compare task is used to generate DDL, care needs to be taken to ensure that the objects created are compatible with the target environment.
When you use certain DDL statements to create or alter objects, it is possible that the RDBMS implicitly creates additional objects that are required so that the original objects become usable. Examples of this include:
-
When you create a table with a primary key or unique key, some RDBMS will automatically create an implicit unique index with the same columns as the primary key or unique key.
-
When you create a table with columns that cannot contain
NULLvalues, some RDMBS will automatically create an implicit check constraint for all such columns. -
When you create a table with a
BLOB,CLOB, orDBCLOBcolumn, some RDBMS will automatically create a dedicated tablespace to store the LOB data.
The names of these implicitly created objects are generated automatically by the RDBMS and do not necessarily follow the same naming conventions that were used for the base table. When a table from the above examples participates in a compare process, XDM will generate DDL for the implicitly created source objects, which means that the target objects will be created explicitly. It may be necessary to add mapping rules to a structure compare task in order to specifically rename these objects.
Example:
When you execute the following statement in DB2 for LUW, an implicit unique index on the column ID will be created:
CREATE TABLE "MYSCHEMA"."MYTABLE"
( "ID" INTEGER NOT NULL,
"FIRSTNAME" VARCHAR(128),
"LASTNAME" VARCHAR(128),
PRIMARY KEY ("ID")
)
The implicitly created index uses the schema SYSIBM, and the name of
the index is a unique string, such as SQL130918142230360.
When you include the table in a compare process, and you add a mapping rule
that will change the schema MYSCHEMA to YOURSCHEMA for all object
types, the schema of the index will not be changed. In order to change
the schema of the index from SYSIBM to YOURSCHEMA, you need to set
an additional mapping rule to the structure compare task.
The generated DDL will contain an explicit CREATE TABLE statement
without the PRIMARY KEY clause for the target table, followed by a
CREATE UNIQUE INDEX statement, and an
ALTER TABLE ADD PRIMARY KEY statement. Therefore, DB2 for LUW will not
create an additional unique index in the target environment, but use the
explicitly created unique index instead to enforce the primary key
constraint. Due to the order in which the objects are created, XDM knows
what the name of the target index will be and does not have to query the
target Db2 catalog in order to determine any automatically generated
object names.
XDM Permissions to execute a task
The user needs the following permissions to successfully start the task execution:
-
READpermission on the task and task template, -
EXECUTEpermission on the task, -
SOURCE_USAGEon the source connection, -
TARGET_USAGEon the target connection, -
READpermission on any credential used in the connections, and -
READpermission on any custom parameter used in the task template.
Task procedure
An XDM structure compare task contains four stages. Before executing Stage 1, XDM will create all necessary files and folders in the task directory during the Tailoring process.
- Tailoring
-
All necessary files and folders are created in the task directory.
The following reports are generated by this stage: - Stage 1
-
The structures of the source connection is cached and stored in task files. XDM collects all tables that match at least one selection rule together with their dependent objects. Tables and columns that match any exclude rule will not be in the task’s selection set.
The following reports are generated by this stage: - Stage 2
-
The structures of the target connection are stored in task files. XDM fetches all objects for the target environment matching a table from the source environment after applying mapping rules, if any exist. Exclude rules with scope Target can further reduce the selection set.
The following reports are generated by this stage: - Stage 3
-
XDM compares the structures in the source and target connections and generates DDL for new objects in the target connection, if desired.
The following reports are generated by this stage: - Stage 4
-
XDM executes the DDL that was created in Stage 3 of the task, if any.
The following reports are generated by this stage: