Importing fixed width files

Applies to: Denodo 8.0 , Denodo 7.0 , Denodo 6.0
Last modified on: 04 Jun 2020
Tags: DF data sources

Download document

You can translate the document:

Goal

This document describes how to access fixed width files.

Content

To access fixed-width files with information in a single row, a Delimited File data source can be used.  In the data source creation screen click on “Use tuple pattern and define a regular expression in the “Tuple Pattern” field.  Note that regular expressions in Denodo use a Java Pattern.  When creating the regular expression, external tools like the regular expression tester for Java can be useful.

Example:

A fixed-width file with information in a single row:

President            Year first inauguraPolitical Party

George Washington                   1789None

John Adams                          1797Federalist

Thomas Jefferson                    1801Democratic-Republican

James Madison                       1809Democratic-Republican

James Monroe                        1817Democratic-Republican

John Quincy Adams                   1825Democratic-Republican

This file has three columns.  The widths of the first two columns (from left to right)  are fixed at  21 char and 19 char.  The width of the third column ranges from 1 char to 21 char. So this tuple pattern is used: (.{21})(.{19})(.{1,21}) 

References

Delimited File Sources

Regular Expression Tester for Java

Questions

Ask a question
You must sign in to ask a question. If you do not have an account, you can register here

Featured content

DENODO TRAINING

Ready for more? Great! We offer a comprehensive set of training courses, taught by our technical instructors in small, private groups for getting a full, in-depth guided training in the usage of the Denodo Platform. Check out our training courses.

Training