tRiakInput - 6.3

Talend Open Studio for Big Data Components Reference Guide

EnrichVersion
6.3
EnrichProdName
Talend Open Studio for Big Data
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

Function

tRiakInput reads data from a Riak bucket and send data in the Talend flow.

Purpose

tRiakInput allows you to extract the desired data from a bucket in a Riak node so as to store or apply changes to the data.

tRiakInput properties

Component family

Big Data / Riak

 

Basic settings

Schema and Edit Schema

A schema is a row description. It defines the number of fields (columns) to be processed and passed on to the next component. The schema is either Built-In or stored remotely in the Repository.

Since version 5.6, both the Built-In mode and the Repository mode are available in any of the Talend solutions.

Click Edit schema to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this option to view the schema only.

  • Change to built-in property: choose this option to change the schema to Built-in for local changes.

  • Update repository connection: choose this option to change the schema stored in the repository and decide whether to propagate the changes to all the Jobs upon completion. If you just want to propagate the changes to the current Job, you can select No upon completion and choose this schema metadata again in the [Repository Content] window.

 

Use existing connection

Select this check box and in the Component List click the relevant connection component to reuse the connection details you already defined.

Warning

If you select the Use an existing connection check box, the Nodes table will not be available.

 

Nodes

Fill in the information required for a connection to a Riak cluster.

  • Host: enter the IP address or hostname of a Riak node in the Riak cluster that you want to connect to.

  • Port: enter the listening port number of a Riak node. You can leave this field empty to use its default value 8098.

  • Riak path: enter the Riak path for accessing a Riak node. You can leave this field empty to use its defalt value riak.

One example of the URL for accessing a Riak node is http://127.0.0.1:8098/riak.

For more information about the concepts related to Riak, see http://docs.basho.com/riak/latest/theory/concepts/.

 

Bucket

Type in the name of the bucket from which you want to read data.

 

Key

Type in the key which is associated with the data that you want to read.

 

Output key to column

Select this check box and from the list select the desired column to which the keys will be output.

 

Values column

Customize the columns to which the values will be output.

Advanced settings

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at the Job level as well as at each component level.

Global Variables

NB_LINE: the number of rows read by an input component or transferred to an output component. This is an After variable and it returns an integer.

ERROR_MESSAGE: the error message generated by the component when an error occurs. This is an After variable and it returns a string. This variable functions only if the Die on error check box is cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl + Space to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio User Guide.

Usage

This component always needs an output link.

Log4j

If you are using a subscription-based version of the Studio, the activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User Guide.

For more information on the log4j logging levels, see the Apache documentation at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html.

Limitation

n/a

Scenario: Exporting data from a Riak bucket to a local file

The following scenario describes a Job which reads data from a Riak bucket and writes it into a local txt file.

Prerequisites: The Riak bucket from which you want to export data already exists. In this example, the data from the bucket computer will be exported and the bucket has already imported the following data:

id; company; brand; price; owner
001; Dell; Inspiron 15; 299; Amanda
002; Dell; Inspiron 15R; 549; Linda
003; HP; Pavilion 500-210qe; 539; Marina
004; HP; Pavilion 500-075; 599; Diana

Dropping and linking components

  1. Drop the following components from the Palette to the design workspace: tRiakConnection, tRiakInput, tFileOutputDelimited, and tRiakClose.

  2. Connect tRiakConnection to tRiakInput using a Trigger > On Subjob Ok link.

  3. Connect tRiakInput to tFileOutputDelimited using a Row > Main link.

  4. Connect tFileOutputDelimited to tRiakClose using a Trigger > On Component Ok link.

Configuring the components

Opening a connection to Riak

  1. Double-click tRiakConnection to open its Basic settings view in the Component tab.

  2. In the Nodes table, enter the information of a Riak cluster you want to connect to.

Exporting data from a Riak bucket to a local file

  1. Double-click tRiakInput to open its Basic settings view in the Component tab.

  2. Click Edit schema to define the structure of exported data. In this example, three columns are defined: id, company, and price.

  3. Select the Use an existing connection check box and then select the connection you have configured earlier. In this example, it is tRiakConnection_1.

  4. In the Bucket field, enter the name of the bucket from which the data will be exported, computer in this example.

  5. Select the Output key to column check box , and select the desired column from the list. id is selected in this example.

  6. In the Value columns table, click twice the button and select company and price from the list respectively.

Writing data into a local file

  1. Double-click tFileOutputDelimited to open its Basic settings view in the Component tab.

  2. In the File Name field, enter the full path to the local file in which you want to store the exported data, D:/Output/computer.txt in this example.

  3. Select the Include Header check box.

  4. Leave other settings as they are.

Closing the connection to Riak

  1. Double-click tRiakClose to open its Basic settings view in the Component tab.

  2. Select the connection you want to close from the Component List, tRiakConnection_1 in this example.

Saving and executing the Job

  1. Press Ctrl+S to save your Job.

  2. Execute the Job by pressing F6 or clicking Run on the Run tab.

  3. Go to the local directory where the file is stored and check the exported data from the Riak bucket.