官术网_书友最值得收藏!

Working with flat files - Import option

In the previous section, we discussed the importing of relational tables. Before we start working on importing flat files, we will discuss some important aspects about Flat Files.

Flat files form a very important aspect of any ETL tool.

Flat files are of two types -- delimited and fixed width.

  • In delimited files, the values are separated from each other by a delimiter. Any character or number can be used as the delimiter, but usually, for better interpretation, we use special characters as delimiters. In delimited files, the width of each field is not a mandatory option as each value gets separated by another using a delimiter. Refer to the following screenshot to understand a delimited file. The delimiter used in the file is the comma (,).
  • In fixed width files, the width of each field is fixed. The values are separated from each other by the fixed size of the column defined. There can be issues in reading the data if the size of each column is not maintained properly. As shown in the following screenshot, in the fixed width file, the width of each field is fixed:

Take a look at the description of each field:

  • EMPLOYEE_ID: 4 Bytes
  • FIRST_NAME: 10 Bytes
  • LAST_NAME: 10 Bytes
  • AGE: 2 Bytes
  • JAN_SAL: 4 Bytes
  • FEB_SAL: 4 Bytes
  • LOCATION: 10 Bytes
If the size of a particular value is not equal to the size mentioned, we need to pad the value with spaces.

We move on to working with both the types of Flat Files in the subsequent two subsections.

主站蜘蛛池模板: 怀来县| 馆陶县| 高安市| 巴林右旗| 嫩江县| 丰县| 清丰县| 慈溪市| 霸州市| 大石桥市| 房产| 萍乡市| 天峻县| 漠河县| 溧水县| 元江| 南雄市| 光泽县| 丹东市| 汤阴县| 抚顺县| 屏边| 漯河市| 高州市| 墨竹工卡县| 砀山县| 怀仁县| 昌乐县| 安西县| 金湖县| 汝州市| 五寨县| 民县| 上饶县| 尼勒克县| 黎川县| 当雄县| 盐池县| 都江堰市| 瑞昌市| 尼勒克县|