Explains how to retrieve data from a flat file.
Follow the instructions below to retrieve data from a flat file.
- Select File > New > Transformation in the upper left corner of the Spoon window to create a new transformation.
- Under the Design tab, expand the Input node; then, select and drag a Text File Input step onto the canvas.
- Double-click on the Text File input step. The Text file input window appears. This window allows you to set the properties for this step.
- In the Step Name field, type Read Sales Data. This renames the Text file input step to Read Sales Data.
- Click Browse to locate the source file, sales_data.csv, available at
...\design-tools\data-integration\samples\transformations\files. (The Browse button appears near the top right side of the window near the File or Directory field.) Click Open. The path to the source file appears in the File or directory field.
- Click Add. The path to the file appears under Selected Files.
- To look at the contents of the sample file:
- Click the Content tab, then set the Format field to Unix.
- Click the File tab again and click the Show file content near the bottom of the window.
- The Nr of lines to view window appears. Click the OK button to accept the default.
- The Content of first file window displays the file. Examine the file to see how that input file is delimited, what enclosure character is used, and whether or not a header row is present. In the sample, the input file is comma (,) delimited, the enclosure character being a quotation mark (“) and it contains a single header row containing field names.
- Click the Close button to close the window.
- To provide information about the content:
- Click the Content tab. The fields under the Content tab allow you to define how your data is formatted.
- Make sure that the Separator is set to comma (,) and that the Enclosure is set to quotation mark ("). Enable Header because there is one line of header rows in the file.
Click the Fields tab and click Get Fields to retrieve the input fields from your source file. When the Nr of lines to sample window appears, enter 0 in the field then click OK.
- if the Scan Result window displays, click Close to close the window.
- To verify that the data is being read correctly:
- Click Preview Rows.
- In the Enter preview size window click OK. The Examine preview data window appears.
- Review the data, then click Close.
- Click OK to save the information that you entered in the step.
- To save the transformation, do these things.
- Select File > Save to save the transformation.
- The Transformation Properties window appears. In the Transformation Name field, type Getting Started Transformation. (Note that the Transformation Properties window appears because you are connected to a repository. If you were not connected to the repository, the standard save window would appear.)
- In the Directory field, click the folder icon.
- Expand the Home directory and double-click the folder in which you want to save the transformation. Your transformation is saved in the DI Repository.
- Click OK to close the Transformation Properties window. When prompted for a comment, enter one then click OK. Your comment is stored for version control purposes in the DI Repository.