marklogic-community / marklogic-spring-batch

Write batch processing applications in MarkLogic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Read all Information Schema from a relational database

sastafford opened this issue · comments

As a developer
I want to Read the table metadata from a relational database table
So that I can process this data for batch processing.

Notes

Project: rdbms
Package: com.marklogic.spring.batch.item.rdbms
Class: InformationSchemaItemReader implements ItemStreamReader

Recommend to test with H2 Database. RDBMSs which support information_schema include:

  • Microsoft SQL Server
  • MySQL
  • PostgreSQL
  • InterSystems Caché
  • H2 Database
  • HSQLDB
  • MariaDB

Recommend that this class inherits from a JdbcCursorItemReader. Preset the sql attribute to read all table names and columns for each table.

Unit Tests

Given an relational database with an Information Schema
When the InformationSchemaItemReader reads from the database
Then a ResultSet is returned with the table metadata.

Example

Column, Table, Type
name, Customer, string
address, Customer, string
invoiceId, Invoice, integer
customerId, Invoice, integer
total, Invoice, float