• No results found

Getting Started with Talend Open Studio

In document DBA 3: Creating a Data Warehouse (Page 51-56)

So far we haven't really used any features o f Talend Open Studio . That's abo ut to change. Befo re we get started, switch to the se co nd OST pe rspe ct ive by clicking o n the red leaf with a 2 inside it:

Note

Feel free to resize any widget o n yo ur screen. Yo u can always get back to the default perspective byclicking o n the red leaf. On the left side o f the screen yo u will see a tab called "Repo sito ry." The text may be truncated to "Rep," depending o n the width o f yo ur screen.

The repo sito ry is where TOS sto res all o bjects related to yo ur pro ject. They are: Business Mo dels - diagrams to do cument pro cesses o r flo ws. Jo b Designs - implemented pro cesses o r flo ws.

Co ntexts - sets o f variables o r values that are shared acro ss several jo bs. Co de - bits o f Java co de shared acro ss several jo bs.

SQL Patterns - templates o f SQL co de that can be used as a basis fo r queries in jo bs.

Metadata - data abo ut yo ur data - database co nnectio ns, file layo uts, and descriptio ns o f database tables and query results.

Do cumentatio n - sto rage fo r wo rd do cuments, spreadsheets and o ther items created o utside o f TOS. Recycle bin - last sto p fo r trash, just like the recycle bin in Windo ws.

To simplify things, fo r this co urse we wo n't use Business Mo dels, Co de, SQL Patterns, o r Do cumentatio n.

Your First TOS Job

No w that yo u've read a little abo ut TOS, it's time to create a simple jo b. Right click o n J o b De signs and cho o se Cre at e J o b:

Name the jo b ET LDe m o and click finish:

If everything went o kay, yo u will see a blank "canvas" fo r Job ETL Demo 0.1 and a new Palette on the lower left:

Right no w yo ur ETL jo b is blank, so it do esn't do anything. We need to add a data so urce. On the Palette, click File to expand that catego ry, then click Input .

Note

If yo u do n't see Input , click o n the up and do wn arro ws.

Click t File Input De lim it e d o nce to select, then mo ve yo ur mo use o ver the canvas. Click the canvas to dro p the t File Input De lim it e d widget.

Yo ur canvas sho uld no w lo o k like this:

So , what's with that red circle with the X thro ugh it? Drag yo ur mo use o ver that circle, and yo u'll see this:

The warning and erro r o ccur because we haven't set any pro perties o n the t File Input De lim it e d widget. Let's do that no w. Click o nce in the middle o f the t File Input De lim it e d widget, then switch to the Co m po ne nt tab at the bo tto m o f the screen:

No w yo u'll see the basic aspects o f t File Input De lim it e d that yo u can mo dify. We'll need to change the file to po int to a sample CSV input. Change the File Name so it lo o ks like this:

CODE TO TYPE:

"C:/talend_files/in/csv/customer1.csv"

WARNING

Make sure yo u type fo rward slashes ( // ) instead o f the usual back slashes ( \\ ). Under the ho o d,TOS is using Java to run yo ur transfo rmatio n; back slashes are used to delimit special characters in Java.

Next, we want TOS to skip o ver the header ro w in the file. To do this, change the 0 next to He ade r to a 1. 1 tells TOS to skip o ne ro w at the beginning o f the file.

No w that we've specified the input file, we need to specify the schema (structure) o f the input file. We do this by clicking the butto n named "..." next to Edit Sche m a. Yo u may have to scro ll the co mpo nent panel to see the Sche m a.

Note

Read thro ugh the next set o f instructio ns befo re trying them. TOS uses many modal windo ws (windo wsthat are always o n to p o f o ther windo ws), so yo u wo n't be able to scro ll in this lesso n unless yo u clo se the mo dal windo w.

After yo u click the butto n, yo u'll see an empty windo w:

No w we co uld click the butto n to add co lumns to the schema. And we co uld enter the schema by hand, but instead we'll impo rt it fro m an XML file. Click o n the ico n to the left o f the flo ppy disk - it lo o ks like this:

Pick C:\talend_files\in\csv\customer1_Schema.xml as the file and click OK.

With the schema impo rted, yo u'll see the definitio ns o f all o f the co lumns. It will lo o k so mething like this:

Click OK to save yo ur changes. The red circle with the X is go ne no w, replaced by a warning sign. The warning still exists because we do n't have a destinatio n fo r o ur data.

Note

Transfo rmatio ns are no t always necessary. So metimes there isn't anything to do o ther than read datafro m o ne place and place it so mewhere else.

In document DBA 3: Creating a Data Warehouse (Page 51-56)