Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

Chapter 12. Metadata-specific Modeling

12.1. Relational Source Modeling

12.1.1. Source Function

To improve ability to utilize database functions within View transformations, Source Function action and wizard is added to Teiid Designer. Source Function assists you in building a source procedure that conforms to a function structure, including input and output parameters. Click New Child > Procedure to open the Procedure Type dialog.
New Source Function Action

Figure 12.1. New Source Function Action

Select Source Function action to open Create Relational Source Function dialog. Enter your database function name, define input parameters including datatype and length, specify output parameter info, set options and click OK.
New Source Function Action

Figure 12.2. New Source Function Action

The resulting source function will be added to your model and will be represented by the icon.
Create New Source Function Dialog

Figure 12.3. Create New Source Function Dialog

When finished, the new source function will be displayed in your model's package diagram.
New Source Function In Package Diagram

Figure 12.4. New Source Function In Package Diagram

After saving your model, your new source function will be available for use in your transformations. If you open the Expression builder, your source functions will be selectable in the Function drop-down selector for a Category named for the model.

12.1.2. Create Relational Table Wizard

You can create table with the action New Child > Table...
New Relational Table Wizard Action

Figure 12.5. New Relational Table Wizard Action

Running the action will display the Create Relational Table wizard. The wizard page contains tabbed panels representing the various properties and components that make up the possible definition of a relational table. Enter your table name, define columns, keys, constraints and other options, then click OK.
This wizard is designed to provide feedback as to the completeness of the relational table information as well as the validation state of the table and its components. Note that although errors may be displayed during editing, the wizard is designed to allow finishing with the construction of an incomplete table containing errors.
The first tab labeled Properties contains the input for the simple table properties including name, name in source, cardinality, supports update and is system table properties.
Properties Tab

Figure 12.6. Properties Tab

The Columns tab allows creation and editing of basic relational columns. This includes adding, deleting or moving columns as well as changing the name, datatype and length properties.
Columns Tab

Figure 12.7. Columns Tab

The Primary Key tab allows editing of the name, name in source and column definitions.Note that clearing the box will clear the data. The Unique Constraint tab contains the identical information.
Primary Key Tab

Figure 12.8. Primary Key Tab

The Foreign Keys tab allows creating, editing and deleting multiple foreign keys.
Foreign Keys Tab

Figure 12.9. Foreign Keys Tab

To create a new Foreign Key, select the Add button and enter/select the properties, key references in the tables shown below. Note that the Select Primary Key or Unique Constraint table will display any PK/UC existing in the selected relational model. If no tables in that model contain a PK or UC, then the table will be empty.
Create Foreign Key Dialog

Figure 12.10. Create Foreign Key Dialog