15.2. Previewing Data For a Model
15.2. Previewing Data For a Model 15.2.1. Previewing Data For a Model Designing and working with data is often much easier when you can see the information you're working with. The Teiid Designer's Preview Data feature makes this possible and allows you to instantly preview the information described by any object, whether it's a physical table or a virtual view. In other words, you can test the views with actual data by simply selecting the table, view, procedure or XML document. Previewing information is a fast and easy way to sample the data. Of course, to run more complicated queries like what your application likely uses, simply execute the VDB Via DTP and type in any query or SQL statement. After creating your models, you can test them by using the Preview Data action . By selecting a desired table object and executing the action, the results of a simple query will be displayed in the SQL Results view. This action is accessible throughout the Teiid Designer in various view toolbars and context menus. There are two requirements for previewing your data: The selected object must be one of several previewable model object types. All source models within the model dependency tree must reference a connection profile. Model objects that can be previewed include: relational tables and views (including tables involving access patterns), relational procedures, Web service operations and XML document staging tables. Note any virtual table, view or procedure is previewable as long as all physical source models reference sufficient connection info. After clicking the Preview Data action, Teiid Designer will insure that all source models are associated with connection profiles and that all required passwords are set. If the model selected for preview is a source model and there is insufficient connection info for that model, the following dialog will be displayed and the action terminated. Figure 15.3. Preview Not Available If any of the source models in the corresponding project require a password that cannot be retrieved from an existing connection profile, the user will be queried for each missing password. Figure 15.4. Missing Password Testing Your Transformations When editing transformation SQL in the Transformation Editor, a special SQL Results data action is provided in the editor toolbar . You can change your transformation SQL, re-validate and preview your the data for your modified SQL. The following sections provide steps for previewing your data. Note that all steps assume that all source models referenced by your models, either directly or through dependencies, are bound to connector bindings. 15.2.2. Preview Relational Table or View To preview a relational table, relational view or staging table: Select a relational table or view in the Model Explorer view or diagram. The table or view can be in a view model as well as a source model. Staging tables are not visible in the Model Explorer view, so you need to open the mapping diagram and select it there. Right-click select the Preview Data action . You can also select the same action in the toolbar of either the Model Explorer view or diagram. Your query results will be displayed in the SQL Results view. The view will automatically open or get focus if not visible in your perspective. 15.2.3. Preview Relational Table With Access Pattern To preview a relational table or view with access pattern: Select a relational table or view in the Model Explorer view or diagram that contains an access pattern. The table or view can be in a view model as well as a source model. Right-click select the Preview Data action . You can also select the same action in the toolbar of either the Model Explorer view or diagram. A column input dialog is presented. Select each access pattern and enter a value for each required column. Note If data entered does not match the column datatype (String, integer, etc...), an error message will be displayed in the dialog header. When all required values are entered, click the OK button to execute the query. Figure 15.5. Access Pattern Column Input Dialog Your query results will be displayed in the SQL Results view. The view will automatically open or get focus if not visible in your perspective. 15.2.4. Preview Relational Procedure To preview a relational procedure: Select a relational procedure in the Model Explorer view or diagram. The procedure can be in a view model as well as a source model. Right-click select the Preview Data action . You can also select the same action in the toolbar of either the Model Explorer view or diagram. An input parameter input dialog is presented. Enter a valid value for each parameter. Note If data entered does not match the parameter datatype (String, integer, etc...), an error message will be displayed in the dialog header. When all required values are entered, click the OK button to execute the query. Figure 15.6. Procedure Parameter Input Dialog Your query results will be displayed in the SQL Results view. The view will automatically open or get focus if not visible in your perspective. 15.2.5. Preview Web Service Operation To preview a Web service operation: Select a Web service operation in the Model Explorer view or diagram. The operation can be in a view model as well as a source model. Right-click select the Preview Data action . You can also select the same action in the toolbar of either the Model Explorer view or diagram. An input parameter input dialog is presented. Enter a valid value for each parameter. Note If data entered does not match the parameter datatype (String, integer, etc...), an error message will be displayed in the dialog header. When all required values are entered, click the OK button to execute the query. Figure 15.7. Procedure Parameter Input Dialog Your query results will be displayed in the SQL Results view. The view will automatically open or get focus if not visible in your perspective. 15.2.6. Sample SQL Results for Preview Data Preview Data results are displayed in the Eclipse Datatools SQL Results view as shown below. Note There are a number of display preference and filter options for this view via toolbar buttons and the drop-down menu. Figure 15.8. SQL Results View 15.2.7. Execution Plans When Preview Data is executed and you checked Generate Execution Plan option in the Custom Preview Data dialog, you can also show the Teiid Execution Plan view as shown below. The Execution Plan may also be obtained by right-clicking on a previewable object, then selecting Modeling > Show Execution Plan in the context menu. Figure 15.9. Teiid Execution Plan View