DotNET Components Guide - Talend Open Integration Solution

advertisement
tDotNETInstantiate
tDotNETInstantiate Properties.
Component
Family
DotNET
Function
Instantiates an Object in .NET for later reuse.
Purpose
Invoke the constructor of a .NET object that is intended for later reuse.
Basic settings Dll to load
This is the path to the dll or the assembly’s name such as
"System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
Fully Qualified
The fully qualified name for the class.
Class name
Value(s) to
pass to the
constructor
Usage
The list of values to pass to the constructor for the object.
Leave empty for a default constructor to be called.
This can be used in a flow or as a start component or as an independent subjob.
Scenario
For use cases in relation with tDotNETInstantiate, see the tDotNetRow scenario: utilizing .NET
in talend.
tDotNETRow
tDotNETRow Properties
Component
Family
DotNET
Function
Send data to and from libraries and classes within .NET or other custom DLLs
Purpose
The tDotNETRow component is to facilitate transforming data by utilizing
possibly custom or built in .NET Classes
Basic settings
Schema and Edit
Schema
A schema is a row description, i.e., it defines the number of fields that
will be processed and passed on to the next component. The schema is
either built-in or stored remotely in the Repository.
Built-in: The schema will be created and stored locally for this
component only. Related topic: How to set a built-in schema of Talend
Open Studio User Guide.
Repository: The schema already exists and is stored in the Repository,
hence can be reused in various projects and job designs. Related topic:
How to set a repository schema of Talend Open Studio User Guide.
Use a static
method
The method that you want to invoke in .NET is a static
method, so it doesn’t need to instantiate or reuse an existing
instantiation for it.
Use an existing
instance
To reuse an instance of a .NET object that was either created
with a tDotNETInstantiate or another tDotNETRow
component.
Dll to load
Can contain either the absolute path to the dll containing the
class(es) that need to be loaded or the assembly name.
Fully qualified
class name
The class to use including any namespaces in which it
resides.
Method Name
The name of the method to invoke on the .NET Object.
Only relevant if Use a static method and Use an existing
Value(s) to pass
instance are both false. Contains the list of parameters to
to the constructor
pass to the constructor when creating the instance.
Method
Parameters
The parameters to pass to the method. In this instance,
values can be either from the row that’s coming into the
component or static values.
Output value
target column
The column in the output row into which to put the value.
Existing instance Select the instance from the drop down list, this will include
to use
all of the other tDotNET prefixed components return values.
Advanced
Parameters
Create a new
instance at each
row
Creates a new instance with each row that passes through the
component.
Method doesn’t
return a value
The method that’s invoked processes data but doesn’t
provide a value as a result of the processing.
Returns an
instance of a
.NET Object
The result of the method that’s being invoked is another
instance of a .NET object.
Store the returned The value that’s returned from the method is going to be
value for later use reused in another tDotNETRow.
Usage
This component is utilized to integrate with .NET objects over rows of data.
Scenario: utilizing .NET in talend.
This scenario describes a four component job that intends to use a custom .NET dll containing a
class called “SenarioClass” that’s not in a namespace and invoke a method on it that
concatenates two Strings together with a space.








Drag and drop a tDotNETInstantiate, tRowGenerator, tDotNETRow and tLogRow.
Connect the tDotNETInstantiate to the tRowGenerator using a trigger connection of type
OnSubjobOk.
Double-click on the tDotNETInstantiate component to configure the instantiation of the
object.
Fill in the Dll to load parameter with the absolute path to the dll that contains the class
we want to instantiate. Alternatively, this can be the assembly’s name such as
"System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
In this scenario, it’s using a custom dll, so set the path to the dll.
Populate the Fully qualified class name with the fully qualified class name. In this
instance, the class that’s being utilized doesn’t reside in a namespace so we can simply
place its name in the parameter.
If there are parameters for the constructor we can provide them in the Value(s) to pass to
the constructor area.
A tRowGenerator is used to generate random data. Double-click on the tRowGenerator
component to launch the editor.
Define the schema of the rows to be generated and the nature of data to generate. In this
example, the rows to be processed contain a First Name and Last Name both of which are
Strings.








Some schema information don’t necessarily need to be displayed. To hide them away, click on
Columns list button next to the toolbar, and uncheck the relevant entries, such as Precision or
Parameters.
Use the plus button to add as many columns to your schema definition.
Click the Refresh button to preview the first generated row of your output.
Then double-click on the tDotNETRow component.
Select Use an existing instance to reuse the instance created in the tDotNETInstantiate.
Select that component from the Existing instance to use drop down list, in this case it’s
tDotNETInstantiate_1.
Fill in the Method Name
Click the three dots next to Edit schema and bring up the schema editor.





First, click the button with two arrows to copy over the other columns to the output.
Then click the green plus under the right hand side and name the new column Name.
Click Ok to return to the component settings.
Under Method Parameters click the green plus twice to add two parameters.
The first is input_row.First_Name and the second is input_row.Last_Name.
In the drop down list for Output value target column select Name.

Leave the tLogRow as it is and execute the job.
tOleDbInput
tOleDbInput properties
Compone Database/Ole
nt Family Db
Function Retrieve data from a database using OleDb.
Purpose
Allows interaction with databases that typically don’t have other means of easy
integration
Basic
settings
A schema is a row description, i.e., it defines the number of fields that will be
Schema and Edit
processed and passed on to the next component. The schema is either built-in or
Schema
stored remotely in the Repository.
Built-in: The schema will be created and stored locally for this component only.
Related topic: How to set a built-in schema of Talend Open Studio User Guide.
Repository: The schema already exists and is stored in the Repository, hence can
be reused in various projects and job designs. Related topic: How to set a
repository schema of Talend Open Studio User Guide.
Database
Provide the connection URL to the database, formatted for oledb.
An example of this is:
"provider=sqloledb;server=(local)\\SQLEXPRESS;database=demo;I
ntegrated Security=SSPI"
Table Name
The name of the table from which to pull the data
Query Type
and Query
The query for the database. Insure that the query and the schema
columns are aligned. Take special care with escape characters as
some of them aren’t supported in certain circumstances.
Trim all the
Advanced
String/Char
Paramete
columns
rs
Select this check box to remove leading and trailing whitespace from
all the String/Char columns.
Trim Column Remove leading and trailing whitespace from defined columns.
tStatCatcher
Statistics
Usage
Select this check box to collect log data at the component level.
This component is utilized to select rows of data from a database using an oledb
provider.
tOleDbOutput
tOleDbOutput properties
Compone Database/Ole
nt Family Db
Function Send data to database(s) using OleDb
Purpose
Basic
settings
Allows interaction with databases that typically don’t have other means of easy
integration
Database
Provide the connection URL to the database, formatted for oledb.
An example of this is:
"provider=sqloledb;server=(local)\\SQLEXPRESS;database=demo;I
ntegrated Security=SSPI"
Table
The name of the table from which to pull the data
Action on
Data
On the data of the table defined, you can perform: Insert: Add new entries to the
table. If duplicates are found, Job stops. Update: Make changes to existing entries
Insert or update: Add entries or update existing ones. Update or insert: Update
existing entries or create it if non existing Delete: Remove entries corresponding
to the input flow. It is necessary to specify at least one column as a primary key on
which the Update and Delete operations are based. You can do that by clicking
Edit Schema and selecting the check box(es) next to the column(s) you want to set
as primary key(s). For an advanced use, click the Advanced settings view where
you can simultaneously define primary keys for the Update and Delete operations.
To do that: Select the Use field options check box and then in the Key in update
column, select the check boxes next to the column names you want to use as a
base for the Update operation. Do the same in the Key in delete column for the
Delete operation.
Clear data in
Select this check box to delete data in the selected table before any operation.
table
A schema is a row description, i.e., it defines the number of fields that will be
Schema and Edit
processed and passed on to the next component. The schema is either built-in or
Schema
stored remotely in the Repository.
Built-in: The schema will be created and stored locally for this component only.
Related topic: How to set a built-in schema of Talend Open Studio User Guide.
Repository: The schema already exists and is stored in the Repository, hence can
be reused in various projects and job designs. Related topic: How to set a
repository schema of Talend Open Studio User Guide.
Advanced Additional
Paramete Columns
rs
This option is not offered if you create (with or without drop) the DB table. This
option allows you to call SQL functions to perform actions on columns, which are
not insert, nor update or delete actions, or action that require particular
preprocessing.
Name: Type in the name of the schema column to be altered or inserted as new
column
SQL expression: Type in the SQL statement to be executed in order to alter or
insert the relevant column data.
Position: Select Before, Replace or After depending on the action to be
performed on the reference column.
Reference column: Type in a column of reference that the tDBOutput can use to
place or replace the new or altered column.
Usage
Use Field
Options
Select this check box to customize a request, especially when there is double
action on data.
Enable debug
mode
Select this check box to display each step during processing entries in a database.
tStatCatcher
Statistics
Select this check box to collect log data at the component level.
This component offers the flexibility benefit of the DB query and covers all of the SQL queries
possible. This component must be used as an output component. It allows you to carry out actions
on a table or on the data of a table in a database.
tOleDbSQLRow
tOleDbSQLRow properties
Compone Database/Ole
nt Family Db
Function
tOleDbSQLRow is the generic component for database query. It executes the SQL query stated onto
the specified database. The row suffix means the component implements a flow in the job design
although it doesn’t provide output. For performance reasons, specific DB component should always
be preferred to the generic component.
Purpose
Depending on the nature of the query and the database, tDBSQLRow acts on the actual DB structure
or on the data (although without handling data). The SQLBuilder tool helps you write easily your SQL
statements
Basic
settings
Database
Provide the connection URL to the database, formatted for oledb.
An example of this is:
"provider=sqloledb;server=(local)\\SQLEXPRESS;database=demo;I
ntegrated Security=SSPI"
A schema is a row description, i.e., it defines the number of fields that will be
Schema and Edit
processed and passed on to the next component. The schema is either built-in or
Schema
stored remotely in the Repository.
Built-in: The schema will be created and stored locally for this component only.
Related topic: How to set a built-in schema of Talend Open Studio User Guide.
Repository: The schema already exists and is stored in the Repository, hence can
be reused in various projects and job designs. Related topic: How to set a
repository schema of Talend Open Studio User Guide.
Table Name
The name of the table from which to pull the data
Query Type
and Query
The query for the database. Insure that the query and the schema
columns are aligned. Take special care with escape characters as
some of them aren’t supported in certain circumstances.
Propagate
Advanced
QUERY’s
Paramete
recordset
rs
Select this check box to insert the result of the query into a COLUMN of the
current flow. Select this column from the use column list.
Use Prepared
Statement
Select this checkbox if you want to query the database using a
PreparedStatement. In the Set PreparedStatement Parameter table, define the
parameters represented by “?” in the SQL instruction of the Query field in the
Basic Settings tab. Parameter Index: Enter the parameter position in the SQL
instruction. Parameter Type: Enter the parameter type. Parameter Value: Enter
the parameter value. This option is very useful if you need to exe-cute the same
query several times. Perfor-mance levels are increased
tStatCatcher
Statistics
Select this check box to collect log data at the component level.
Usage
This component offers the flexibility of the DB query and covers all possible SQL queries. Note: Use
the relevant DBRow component according to the DB type you use. Most of databases have their
specific DBRow components.
NOTES: Due to the similarity between these components and the tDB? Components on which they’re
based, the scenarios for them could easily be reused. The primary differences are missing functionality
in these that aren’t supported by OleDb or due to undocumented “features” of OleDb. In addition, this
requires that you know the correct connection URL because in most instances the user name and
password are embedded into it and they’re starkly different for each of the different DBMS providers
(i.e. for one of them it’s User=<user name>;Password=<password> and for some it’s Login and Pass, etc).
Case in point: there’s a website devoted entirely to oledb connection strings:
http://www.connectionstrings.com/ and some versions of a given DBMS (i.e. SQL Server 2000) have
several distinct and different connection strings that can be used based upon numerous environmental
factors.
Download