DB2 database plugin

Introduction

A separate database plugin to support DB2-specific features and configurations.

Use-Case

  • Users can choose and install DB2 source and sink plugins.
  • Users should see DB2 logo on plugin configuration page for better experience.
  • Users should get relevant information from the tool tip:
    • The tool tip for the connection string should be customized specifically to the DB2 database,
    • The tool tip should describe accurately what each field is used for.
  • Users should not have to specify any redundant configuration (ex: JDBC type in source plugin, columns in the sink plugin).
  • Users should get field level lineage for the source and sink that is being used.
  • Reference documentation should be updated to account for the changes.
  • The source code for DB2 database plugin should be placed in repo under data-integrations org.
  • Integration tests for DB2 database plugin should be added in the test repo.
  • The data pipeline using source and sink plugins should run on both mapreduce and spark engines.

User Stories

  • User should be able to install DB2 specific database source and sink plugins from the Hub
  • Users should have each tool tip accurately describe what each field does
  • Users should get field level lineage information for the DB2 source and sink
  • Users should be able to setup a pipeline avoiding specifying redundant information
  • Users should get updated reference document for DB2 source and sink
  • Users should be able to read all the DB types

Plugin Type

  • Batch Source
  • Batch Sink 
  • Real-time Source
  • Real-time Sink
  • Action
  • Post-Run Action
  • Aggregate
  • Join
  • Spark Model
  • Spark Compute

Design Tips

DB2 connector reference: https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_r0052075.html

Existing database plugins: https://github.com/cdapio/hydrator-plugins/tree/develop/database-plugins

DB2 datatypes mappings and conversions: https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_rjvjdata.html


Design

The suggestion is to create maven submodule db2-plugin under database-plugins repo.


Sink Properties

User Facing NameTypeDescriptionConstraints
LabelString Label for UI
Reference NameStringUniquely identified name for lineage
HostStringDB2 hostRequired (defaults to localhost on UI)
PortNumberSpecific port which DB2 is listening to

Optional

(default 50000)

DatabaseStringDatabase name to connectRequired
UsernameStringDB usernameRequired
PasswordPasswordUser passwordRequired
Transaction Isolation LevelSelectTransaction isolation level for queries run by this sink
Connection ArgumentsKeyvalue

A list of arbitrary string tag/value pairs as connection arguments, list of properties:

DB2 connection properties


Table NameStringName of a database table to write to

Source Properties


User Facing NameTypeDescriptionConstraints
LabelStringLabel for UI
Reference NameStringUniquely identified name for lineage
HostStringDB2 hostRequired (defaults to localhost on UI)
PortNumberSpecific port which DB2 is listening to

Optional

(default 50000)
DatabaseStringDatabase name to connectRequired
Import QueryStringQuery for import dataValid SQL query
UsernameStringDB usernameRequired
PasswordStringUser passwordRequired
Bounding QueryStringReturns max and min of split-By FiledValid SQL query
Split-By Field NameStringField name which will be used to generate splits
Number of Splits to GenerateNumberNumber of splits to generate
Transaction Isolation LevelSelectTransaction isolation level for queries run by this sink
Connection ArgumentsKeyvalue

A list of arbitrary string tag/value pairs as connection arguments, list of properties:

DB2 connection properties



Action Properties


User Facing NameTypeDescriptionConstraints
LabelStringLabel for UI
HostStringDB2 hostRequired (defaults to localhost on UI)
PortNumberSpecific port which DB2 is listening to

Optional

(default 50000)
DatabaseStringDatabase name to connectRequired
Username

String

DB usernameRequired
PasswordStringUser passwordRequired
Connection ArgumentsKeyvalue

A list of arbitrary string tag/value pairs as connection arguments, list of properties:

DB2 connection properties


Database CommandStringDatabase command to runValid SQL query


Data Types Mapping

DB2 Data TypeCDAP Schema Data TypeSupportComment
SMALLINTSchema.Type.INT+
INTEGERSchema.Type.INT+
BIGINTSchema.Type.LONG+
DECIMAL(p,s) or NUMERIC(p,s)Schema.LogicalType.DECIMAL+
DECFLOATSchema.Type.STRING+
REALSchema.Type.FLOAT+
DOUBLESchema.Type.DOUBLE+
CHARSchema.Type.STRING+
VARCHARSchema.Type.STRING+
CHAR(n) FOR BIT DATASchema.Type.BYTES+
VARCHAR(n) FOR BIT DATASchema.Type.BYTES+
BINARYSchema.Type.BYTES+
VARBINARYSchema.Type.BYTES+
GRAPHICSchema.Type.STRING+
VARGRAPHICSchema.Type.STRING+
CLOBSchema.Type.STRING+
BLOBSchema.Type.BYTES+
DBCLOBSchema.Type.STRING+
ROWID
-Not all flavors of DB2 support this type
XML
-Not all flavors of DB2 support this type
DATESchema.LogicalType.DATE+
TIMESchema.LogicalType.TIME_MICROS+
TIMESTAMPSchema.LogicalType.TIMESTAMP_MICROS+


Approach

Create a module db2-plugin in database-plugins project, reuse existing database-plugins code if possible. Add DB2-specific properties to configuration, add support for DB2-specific datatypes. Update UI widgets JSON definitions.

Pipeline Samples


API changes

Deprecated Programmatic APIs

database-plugins is moved to Data Integrations

UI Impact or Changes

Configurable database properties are presented as named text fields instead of arbitrary key value pairs. DB2 source and sink are separate entries with DB2 logo in source and sink lists.

Test Scenarios

TODO

Releases

Release X.Y.Z

Related Work

Database plugin enhancements

Future work

AuroraDB database plugin