当前位置:网站首页>Kettle paoding jieniu Chapter 17 text file output

Kettle paoding jieniu Chapter 17 text file output

2022-04-23 18:20:00 Feige big data

introduction

in front 16 In this article , We introduce some common input components in detail . Start with this article , We mainly talk about the output components .

In this article , Our main explanation is :kettle Text file output in .

transformation

transformation (transaformation) yes ETL The main part of the solution , It handles extraction 、 transformation 、 Loading various operations on data lines .

Create transformations

What we have to do ETL operation , It's all designed in transformation , So we need to create a transformation first .

kettle Paoding jieniu di 17 Text file output of Chapter _excel Input

kettle Paoding jieniu di 17 Text file output of Chapter _kettle_02

Save conversion

kettle Paoding jieniu di 17 Text file output of Chapter _ Homework _03

Give you a new conversion , Name it , And save

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _04

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _05

Text file output

Through this component , Output the data stream to a text file and save .

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _06

kettle Paoding jieniu di 17 Text file output of Chapter _excel Input _07

a、 The file name specifies

1、 Document labels , Specify which file the output data is saved to locally , Click on “ Browse ” Button , Browse local disk location , Then hand write txt file name .

kettle Paoding jieniu di 17 Text file output of Chapter _ Homework _08

kettle Paoding jieniu di 17 Text file output of Chapter _excel Input _09

kettle Paoding jieniu di 17 Text file output of Chapter _ Homework _10

kettle Paoding jieniu di 17 Text file output of Chapter _ Text file output _11

2、 Option description

Options

describe

File name

Output file name .

Output passed to servlet

After checking , All outputs will be directed to Servlet Character output stream , Instead of persistent files . You can imagine that the contents of the file are redirected to a... On the server side Web Address . And the conversion using this step , May be through Carte perhaps DIServer Remote service to start , In this way, the execution container of the transformation becomes a Servlet, All the output from this step will be redirected to this Servlet In the character output stream of .

Create parent directory

When checked, it will be based on “ File name ” The parent directory is automatically created by the path in

Do not create files at startup

If checked, the file will not be generated at the beginning of conversion .

Get the file name from the field

Use the... In the input stream 7 Controls “ File name field ” The data in is used as the output file name , Check the... Below “ File name field ” Will become optional .

File name field

Specifies the field in the input stream that contains the file name .

Extension

Specifies the extension of the output file name .

The file name contains the number of steps

When the output step is set to multi-threaded execution , Is automatically generated from “0” Step number to start counting .

The file name contains the data area code

If you check the , When using partition mode in the current step , The file name contains the name of the partition ID.

The file name contains the date

Check this box , The generated file name will contain the year 、 month 、 Japan .

The file name contains the time

Check this box , When the generated file name contains 、 branch 、 second .

Specify the date time format

After checking , Control “ Date time format ” Will become available , And generate the file name suffix according to the selected date format .

Date time format

Time format drop-down box , The file name suffix... Will be generated according to the selected format .

Show filename

Preview the generated file name .

Add file name to the result

Check this box , The file name of the conversion result can be saved into the stream , So that it can be obtained in subsequent steps .

b、 The content specified

kettle Paoding jieniu di 17 Text file output of Chapter _ Homework _12

Option description

Options

describe

append mode

Whether to append a line at the end of the specified file .

Separator

Specifies the character that separates the field in the text , for example ; Or tabs .

Closure

A pair of characters that enclose a field . Optional .

Force a closing character around the field

Enclose both sides of each column of data

Disable closure repair

Disable closure repair

Head

If you want to have a head line , Make this option available ( The first line of the document ).

The tail

If you want to have a tail line , Make this option available ( The last line of the document ).

Format

DOS perhaps UNIX.UNIX The file line separator is a newline character .DOS The file can be a line feed or carriage return .

Compress

Specify the type of compression (zip perhaps gzip).

code

Specifies the encoding used by the file . If it is blank, use the system default code .

Field right fill or crop

Add a space or delete a character at the end of the field , Until the length reaches the specified .

Fast data storage ( Unformatted )

When processing large amounts of data into a text file , Improve performance .( Does not contain any formatting information ).

Spin off … Every line

If N Than 0 Big , use N Line split text file , Split into multiple parts .

Add end of file line

Specify the end line of the output text .

c、 Field

Set the fields to export .

kettle Paoding jieniu di 17 Text file output of Chapter _excel Input _13

Below is a list of options for the tag

Options

describe .

name

Set the name of the field to be displayed in the output stream .

type

Field type (StringDateNumber etc. ).

Format

Controls the format of input data ( Integers 、 There are decimal places 、 Date format, etc )

length

about Number: Number of significant numbers .

about String: The length of the characters .

about Date: The length of the printout character ( for example 4 Represents the year of return ).

precision

about Number: Number of floating point numbers .

about String,Date,Boolean: not used .

currency

Used to explain, for example $10,000.00 The number of .

decimal

The decimal point can be ”.(10;000.00) perhaps ”,(5.000,00).

grouping

Grouping can be ”.(10;000.00) perhaps ”,(5.000,00).

Remove empty string mode

Empty before processing .

Null

How to deal with null values .

Okay , About each tab of the text file output component , I explained as much as I could . In fact, in my daily work , Not used so much , There are a few commonly used . But in the process of our study , I'd better speak more fully , I hope you spend time studying , Try to have a general understanding . Let's take an example to operate , This is a better way to absorb and understand .

Actual demonstration

We're going to demonstrate from excel The data is read from the file , Then output the component through a text file , Finally save the data in txt In file

a、 establish excle file

I am here D Under the plate , Create a xlsx file , Name it bigdata. stay sheet1 Design data in , The first 1 Line is the header of the file , From 2 The line starts with data , This file has 2 Column data ..

kettle Paoding jieniu di 17 Text file output of Chapter _excel Input _14

b、 Create transformations

kettle Paoding jieniu di 17 Text file output of Chapter _ Homework _15

c、Excel Enter Settings

increase Excel File as data source

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _16

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _17

kettle Paoding jieniu di 17 Text file output of Chapter _excel Input _18

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _19

Specify the worksheet

kettle Paoding jieniu di 17 Text file output of Chapter _kettle_20

kettle Paoding jieniu di 17 Text file output of Chapter _ Homework _21

Specified field

kettle Paoding jieniu di 17 Text file output of Chapter _ Text file output _22

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _23

d、excle Data preview record

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _24

kettle Paoding jieniu di 17 Text file output of Chapter _kettle_25

kettle Paoding jieniu di 17 Text file output of Chapter _ Text file output _26

e、 Text file output component

kettle Paoding jieniu di 17 Text file output of Chapter _ Homework _27

Use the left mouse button to click Excel Input components , Hold down shift key , from Excel Input components Drag and drop to Text file output Components , The effect after dragging is shown in the figure below :

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _28

f、 Text file output settings

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _29

kettle Paoding jieniu di 17 Text file output of Chapter _kettle_30

kettle Paoding jieniu di 17 Text file output of Chapter _excel Input _31

h、 Run the transformation

kettle Paoding jieniu di 17 Text file output of Chapter _ Homework _32

kettle Paoding jieniu di 17 Text file output of Chapter _ transformation _33

kettle Paoding jieniu di 17 Text file output of Chapter _ Text file output _34

kettle Paoding jieniu di 17 Text file output of Chapter _kettle_35

i、 Verification result file

kettle Paoding jieniu di 17 Text file output of Chapter _kettle_36

Conclusion

This article mainly explains : Various detailed settings of text file output component , Finally, the actual combat demonstrates , from excel The data is read from the file , Then output the component through a text file , Finally save the data in txt In file .

brothers , In fact, there is a distance between thinking and acting , If you think about it, it's gone , But you're doing it , It landed .

Don't say anything , Brothers, follow me and it's over , We still break up the way of kneading to say . The following content is more wonderful , Coming soon , Thank you for your attention !!

版权声明
本文为[Feige big data]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231719565929.html