Writer

These types of classes complement the functionality of the reader. Several types that are described in this section.

  • JdbcWriter

  • CSVWriter

  • TraceWriter

  • JdbcMulti

Properties

Writers are a class that will save data to the specified destination. Common properties :

Field Type Optional Description

type

Following values are allowed :

jdbc,

csv,

trace,

jdbcmulti.

.

No

Type of writer where the loader will store the data.

batch

Number

Yes

SQL commands that are sent to the database server at once.

addNullWhenEmpty

Boolean

Yes

If addNullWhenEmpty was set to true adds null when field is empty.

JdbcWriter

JDBC writer’s implementation that save the data according to configuration in yaml file. JdbcWriter corresponds with "type=jdbc" Following table defines properties.

Field Type Optional Description

url

String

No

Defined by url where the db is running. Example : url: jdbc:leanxcale://localhost:1522/db;txn_mode=NO_CONFLICTS;mode=RUN

user

String

No

Database user.

password

String

No

User’s password.

driver

String

No

Driver to connect to DB. Example : driver: com.leanxcale.client.Driver

batch

Number

Yes

SQL commands that are sent to the database server at once.

addNullWhenEmpty

Boolean

Yes

if addNullWhenEmpty was set to true adds null when field is empty.By default is false.

tsFormat

String

Yes

Timestamp format. By default : yyyy-MM-dd HH:mm:ss.SSS

tables

List

No

"Second level tags" contains information about "JdbcwriterTables".

Example:

writer:
  type: jdbc
  url: jdbc:leanxcale://localhost:1522/db
  user: APP
  password: APP
  tsFormat: yyyy-MM-dd HH:mm:ss
  driver: com.leanxcale.client.Driver
  batch: 1000
  addNullWhenEmpty: false
  tables:
    - name: LOADERRANDOMTEST
      create: true
      ddl:
        - CREATE TABLE IF NOT EXISTS LOADERRANDOMTEST (
          IDTEST BIGINT NOT NULL,
          NAME VARCHAR,
          NUMBER INTEGER,
          FLAG SMALLINT,
          TIMETEST TIMESTAMP,
          SMALLNUMBER SMALLINT,
          PRIMARY KEY (IDTEST))

CSVWriter

This "writer" writes data into a csv file and to use it you need to set it as type="csv". Following table defines properties.

Field Type Optional Description

tables

List

No

"Second level tags" contains information about "CSVWriterTables".

properties

List

Yes

"Second level tags" contains information about "CSVWriterProperties". Example:

[source, yaml] ---- writer: type: csv tables: - name: ACH format: MySQL file: src/test/resources/CdC/bank1.mysql ----

TraceWriter

TraceWriter does not define singular properties and should be used for "test" and will print the result to the console. This writer is defined as follows:

writer:
  type: trace

JdbcMulti

A JDBC writer that unfold the data from a reader into multiple tables. It behaves like a normal jdbc writer but writes the same rows coming from reader into a collection of tables listed in yaml config file.

This scheme may be useful in parallel processing, temporal tables processing or replication of data in different tables. Tables do not have to be identical, but must have fields compatibles with those from the reader. For writing purposes, field types are fetched from the first table of list.

Field Type Optional Description

tables

List

No

List of name tables.

Example:

writer:
  type: jdbcmulti
  tables:
    - name:
        - T1
        - T2
        - T3