Tutorial 1: Convert Relational Database Table to Delimited File
In this tutorial, users will learn how to convert data from a database table to a delimited file.
Conversion Type: One-to-one.
After completing this tutorial, users will be able to do the following:
- Use a connection saved in a previous tutorial.
- Create a delimited connector.
- Map a source to a target using automapping.
- Edit a record layout using the Record Layout Editor.
- Save and run the conversion specification.
- Browse source and target data (after running the conversion specification).
Source and Target Data Descriptions
Data Source
Connector type: Microsoft SQL Server (use a database type installed on the system being used)
Connector name: The connector created in Tutorial 1 in Chapter 2, “Related Extract and Related Loader Tutorials”
Database name: fileaidex_tutorial
Table name: dbo.authors
Data Target
Connector Type: Delimited file
File name and location: <your directory path>/tutorial1.asc
Define the Data Source
The table or view selected as the data source will be converted to the output type specified when the data target is defined.
- Launch ConverterPro like any other application based on your operating system. The ConverterPro dialog box appears, displaying the Data Sources tab. The Data Sources tab allows users to define a data source connection.
- From the Connector Name list, select the connector templates. The Open Connection Template dialog box appears.
- Select the connection created in the first Related Loader tutorial and click OK. The connector panel appears with the connection information prefilled.
- Click Show all tables/views so that all tables and views from the fileaidex_tutorial database will be included in the selection.
- Click Connect. A connection validation confirmation message appears.
- Click OK.
- Click Next. The Table/View Selection panel appears with existing tables and views from the fileaidex_tutorial database listed in the Available Record Layouts box.
Select dbo.authors and click
to add this table to the Selected Record Layouts box.- Click Next. The Data Targets tab appears. The project tree view in the left pane of the ConverterPro window displays the authors table and the chosen connector under the Data Sources node. The actual table name (designated by dbo.authors) and connector are displayed below the authors table. Clicking the table name, actual table name, or connector displays their respective properties in the Properties view. Refer to the ConverterPro online help for detailed information about the project tree and properties views.
Define the Data Target
Use the Data Targets tab to define a target connection and the format of the conversion specification output.
- From the Connector Name list, select new.
- From the Connector Type list, select Delimited File. The Delimited File pane appears.
- In the Connector Name field, type Tutorial1_Delimited.
In the File Name field, type <your directory path>/Tutorial1.asc, or click Browse and navigate to <your directory path> and add file name Tutorial1.asc. The File Name field populates with the path and file name. This file is the data target in this conversion specification and will be created when this specification is run.
- From the Target Action (Exist/Not Exist) list, select Recreate/Create.
- Click Next. The Record Layout Selection pane appears.
- From the Existing Record Layouts box, select authors and click
to add it to the - Click Next. The Data Targets tab displays the field names, field data type, encoding type, and record occurrence or field length of the fields in the authors table.
- From the Record Separator list, select CR-LF.
- Click Next. The Mapping Editor tab appears. The project tree view displays the authors file and Tutorial1_Delimited connector under the Data Targets node. The path and file name are displayed below the authors file.
Map the Source to the Target
The Mapping Editor tab is used to specify source-to-target mapping.
Fields from the source authors table appear in the left pane, while fields from the target authors file appear in the right pane.
Using Automap
Use the automapping feature to map each field in the source authors table to a corresponding field in the target authors file.
If the field names in the source and target files are not the same, a source field can be manually dragged and dropped it onto a target field. In this tutorial, field names in the source table are identical to the field names in the target file, so automapping can be used.
Right-click authors in the Source column, then select Automap > By Field Name Match. All like-named fields are mapped. The automap result appears in the Mapped Field column.
Save and Run the Conversion Specification
Before running this conversion specification, save it to the repository.
- From the File menu, select Save. The Save Conversion As dialog box appears.
- In the Name field, type Tutorial1.
- In the Description field, type <database type> to Delimited File.
Select the Save with Userid/Password check box.
- Click OK and then click Next. The Conversion Customization pane appears. This pane allows users to make modifications to a conversion specification. For this tutorial, no changes are needed.
- Click Next.
- From the Actions menu, select Run to run the conversion. The Execution Status Viewer appears. Its Summary tab displays the conversion specification name (Tutorial1), the database table, delimited file name and location, and the number of records read, inserted, updated, deleted, and discarded. The authors file is written to the directory path specified.
- Select the Details tab. Additional information about the conversion specification is appears.
- Click Close.
Browse the Source and Target
To verify what was written to the target, compare the data in the Source Data Browser with the data in the Target Data Browser.
- Click
. The Source Data Browser appears, displaying the contents or the source database. - Click
. The Target Data Browser appears, displaying the contents of the authors.asc file. - Compare the source and target browsers to see that the conversion converted the information accurately.
- Click OK on both browser windows to return to the ConverterPro window.
Tutorial 1 is now complete.