Define a File Model

This page describes how to define a file server metadata and reverse-engineer files stored on this server.

Create a File Model

To create a new File metadata file:

  1. Click the metadata New Metadata button in the Project Explorer toolbar. The New Model wizard opens.

  2. In the Choose the type of Metadata tree view, select File > File Server.

  3. Click Next.

  4. Select the parent folder or project for your new resource.

  5. Enter a File Name and then click Finish. The metadata editor opens.

  6. Select the Server node. In the Properties view, set the following properties:

    • Name: A user-friendly name for this schema. The Server node is renamed with this name.

    • Driver: com.semarchy.xdi.jdbc.file.FileDriver

    • URL: jdbc:semarchy:file

  7. Right-click the root node of the file model editor and then select Actions > Launch Directory wizard.

  8. In the Directory page, provide a user-friendly Name for the directory and select its Path.

  9. Click Next.

  10. On the File Properties page:

    1. Use the Browse button to select the file in the directory and set the Physical Name for the file.

    2. Set a logical Name for the file datastore.

    3. Select the file Type: Delimited or Positional (fixed-width fields).

  11. Depending on the selected file Type, follow the instructions provided in Reverse-Engineer a Delimited File or Reverse-Engineer a Fixed-Width File.

Reverse-Engineer a Delimited File

To reverse-engineer a delimited file:

  1. In the File Properties page, use the Refresh button to view the content of the file in the preview. Expand the wizard size to see the file contents.

  2. Set the following parameters to match the file structure:

    • Charset Name: Code page of the text file.

    • Line Separator: Character(s) used to separate the lines in the file.

    • Field Separator: Character(s) used to separate the fields in a line.

    • String Delimiter: Character(s) delimiting a string value in a field.

    • Decimal Separator: Character used as the decimal separator for numbers.

    • Lines to Skip: Number of lines to skip from the beginning of the file. This count must include the header.

    • Header Line Position: Position of the header line in the file.

  3. Click Next.

  4. Click Reverse. If the parameters set on the previous page are correct, the list of columns detected in this file is automatically populated.

    • Reverse-engineering parses through a number of lines in the file (defined by the Row Limit) to infer the data types and size of the columns. You can tune the reverse behavior by changing the Reverse Options and Size Management properties, and clicking Reverse again.

    • You can manually edit the data type, size, and name of detected columns in the table.

  5. Click Finish to complete the reverse-engineering.

  6. Press Ctrl+S to save the metadata.

Reverse-Engineer a Fixed-Width File

To reverse-engineer a fixed-width file:

  1. In the File Properties page, use the Refresh button to view the content of the file in the preview. Expand the wizard size to see the file contents.

  2. Set the following parameters to match the file structure:

    • Charset Name: Code page of the text file.

    • Line Separator: Character(s) used to separate the lines in the file.

    • Decimal Separator: Character used as the decimal separator for numbers.

    • Lines to Skip: Number of lines to skip from the beginning of the file. This count must include the header.

    • Header Line Position: Position of the header line in the file.

  3. Click Next.

  4. Click Refresh to populate the preview.

  5. From this screen, you can add, move and edit column definitions for the file. If you add columns, the preview shows the position of the columns in the file.

  6. Click Finish to complete the reverse-engineering.

  7. Press Ctrl+S to save the file.