Enhydrator--The Java 8 Extract Transform Load (ETL) Tool Released

enhydrator is a Java 8, open source, Apache licensed, "no-dependenccies", 95kB jar:


<dependency>
	<groupId>com.airhacks</groupId>
	<artifactId>enhydrator</artifactId>
	<version>0.0.6[or newer]</version>
</dependency>

Enhydrator uses functional Java 8 features and JavaScript (Nashorn) to load, transform and emit table-like datastructures:

Input file (languages.csv):


language;rank
java;1
c;2
cobol;3
esoteric;4

Processing pipeline:

@Test
public void filterAndCastFromCSVFileToLog() {
	Source source = new CSVFileSource("/languages.csv", ";", "utf-8", true);
	VirtualSinkSource sink = new VirtualSinkSource();
	Pump pump = new Pump.Engine().
		from(source).
		filter("$ROW.getColumnValue('language') === 'java'").
		startWith(new DatatypeNameMapper().addMapping("rank", Datatype.INTEGER)).
		to(sink).
		to(new LogSink()).
        build();
		
	Memory memory = pump.start();
	//see the entire example.
    }

I'm using enhydrator for log-file monitoring, JDBC-based backups and code generation. Enhydrator is also used in production in other projects to map various CSV-files into a canonical POJO-based model.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments
License