Component family |
Databases |
|
Function |
tSQLiteRow executes the defined |
|
Purpose |
A prepared statement uses the input flow to replace the |
|
Basic settings |
Property type |
Either Built-in or Repository. Since version 5.6, both the Built-In mode and the Repository mode are |
|
|
Built-in: No property data stored |
|
|
Repository: Select the repository |
|
Use an existing connection |
Select this check box and in the Component List click the NoteWhen a Job contains the parent Job and the child Job, if you need to share an existing
For an example about how to share a database connection across Job levels, see |
|
Schema and Edit |
A schema is a row description. It defines the number of fields to be processed and passed on Since version 5.6, both the Built-In mode and the Repository mode are |
|
|
Built-in: The schema is created |
|
|
Repository: The schema already |
Click Edit schema to make changes to the schema. If the
|
||
|
Query type |
Either Built-in or Repository. Since version 5.6, both the Built-In mode and the Repository mode are |
|
|
Built-in: Fill in manually the |
|
|
Repository: Select the relevant |
|
Query |
Enter your DB query paying particularly attention to properly |
|
Die on error |
Clear this check box to skip the row on error and complete the |
Advanced settings |
Propagate QUERY’s recordset |
Select this check box to insert the result of the query into a NoteThis option allows the component to have a different schema |
|
Use PreparedStatement |
Select this check box if you want to query the database using a
Parameter Index: Enter the
Parameter Type: Enter the parameter
Parameter Value: Enter the NoteThis option is very useful if you need to execute the same |
|
Commit every |
Number of rows to be completed before committing batches of rows |
|
tStat |
Select this check box to collect log data at the component |
Dynamic settings |
Click the [+] button to add a row in the table and fill The Dynamic settings table is available only when the For more information on Dynamic settings and context |
|
Global Variables |
QUERY: the SQL query statement being processed. This is a ERROR_MESSAGE: the error message generated by the A Flow variable functions during the execution of a component while an After variable To fill up a field or expression with a variable, press Ctrl + For further information about variables, see Talend Studio |
|
Usage |
This component offers the flexibility of the DB query and covers |
|
Log4j |
The activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User 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. |
This scenario describes a job which updates an SQLite database file based on a
prepared statement and using a delimited file.
-
Drop a tFileInputDelimited and a tSQLiteRow component from the Palette to the design workspace.
-
On the tFileInputDelimited
Basic settings panel, browse to the input file
that will be used to update rows in the database.
-
There is no Header nor Footer. The Row separator is a
carriage return and the Field separator is a
semi-colon. -
Click the […] button next to Edit schema and define the schema structure in case it is not stored in the Repository.
-
Make sure the length and type are respectively correct and large enough to
define the columns. -
Then in the tSQLiteRow
Basic settings panel, set the Database filepath to the file to be updated.
-
The schema is read-only as it is required to match the input schema.
-
Type in the query or retrieve it from the
Repository. In this use case, we updated the
type_os for the id defined in the
Input flow. The statement is as follows:"Update download set type_os=?
.
where id=?" -
Then select the Use PreparedStatement check
box to display the placeholders’ parameter table.
-
In the Input parameters table, add as many lines as necessary to cover all
placeholders. In this scenario, type_os and
id are to be defined. -
Set the Commit every field.
-
Save the job and press F6 to run it.
The download table from the SQLite database is thus updated with
new type_os code according to the delimited input file.