The SQLFileInsertReceiver creates a file with standard ANSI SQL insert statements.
The DelimitedFileReceiver requires that the following parameters are defined:
- path - Defines the directory path where to store the output file.
- tableName - Defines the name of the SQL table as it is defined in the database.
- fileName - Defines the name of the file the SQL statement will output to.
- batchCount - Defines the number of insert statements written to file in each batch.
- appendToFile - Determines whether the file will open in append mode. If true, SQL statements will be appended to the file; otherwise, the file will be overridden.
- uniqueAttribute - Defines a Domain Attribute the Receiver will use to identify a unique value that has already been inserted into the file and prevents it from being inserted twice.
- statementSeparator - Defines when a SQL statement has ended.
- rowDelimiter - Defines the characters to delimit each row.
Receiver Attribute Property Keys
The Receiver defines two property keys that can be modified on any of its associated Domain Attributes:
- columnName - Defines the actual column name used in the database table.
- include - Determines if the Attribute will be included in each SQL statement.
- useQuotes - Determines if a value should be quoted. Sometimes a numeric value should be quoted (e.g. SSN).
There are two rowDelimiter types:
- UNIX/Linux/Mac-LF - used for Mac, Unix & Linus machines.
- Windows-CR/LF - used for Windows machines.
The following is an example output of SQL inserts statements into a user table.
insert into user(id,first_name,last_name,middle_initial,emailAddress) values ('1','Penelope','Spaeth','F','firstname.lastname@example.org'); insert into user(id,first_name,last_name,middle_initial,emailAddress) values ('2','Carla','Elledge','U','email@example.com'); insert into user(id,first_name,last_name,middle_initial,emailAddress) values ('3','Tori','Adamson','R','firstname.lastname@example.org');
Make sure to pay attention to the naming of the column names for each attribute, that they match the column name as it is defined in the database table.