blob: 10e4f3d10c40e6d63a284370ec0c94d77e9e98eb [file] [log] [blame]
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /plugins/transforms/
:language: en_US
:page-alternativeEditUrl: https://github.com/apache/incubator-hop/edit/master/plugins/transforms/sql/src/main/doc/sql.adoc
= Execute SQL script
== Description
You can execute SQL scripts with this transform, either once, during the initialization phase of the pipeline, or once for every input-row that the transform is given. The second option can be used to use parameters in SQL scripts.
== Options
[width="90%", options="header"]
|===
|Option|Description
|Transform name|Name of the transform; This name has to be unique in a single pipeline
|Connection|Select a database connection to use
|SQL script to execute|Specify the SQL to execute. Separate statements by ; and use question marks as place holders for parameter.
|Execute for each row?|Select this option to execute the SQL for each incoming row. In this case paramters can be used. When this option is unchecked, the SQL statement is executed at the transform initialization phase.
|Execute as a single statement|This option does not split the statements by ; and will send the whole SQL to the database.
|Variable substitution|In case you want to use variables in the SQL, e.g. ${table_name}, this option needs to be checked.
|Bind parameters?|Check this option to bind parameters using prepared statements, otherwise this transform will perform a literal string replacement of the parameters.
|Quote Strings?|This option adds quotes around the string according to the database dialect and also escapes special characters like CR, LF and the quote character itself.
|Parameters|The list of used parameters that will replace the question marks in the query in the given order. So the first question mark will be replaced by the first parameter, the second question mark by the second parameter etc.
|Field to contain insert stats|Optional: If you want to get an additional field in our stream with the number or records that where inserted, please define the field name here.
|Field to contain update stats|Same as insert stats, but for updated rows.
|Field to contain delete stats|Same as insert stats, but for deleted rows.
|Field to contain read stats|Same as insert stats, but for read rows.
|===