Wiki

Clone wiki

avro_from_delimited / UseCase3

Use Case 3 - Separate Schema File

This will be virtually indentical to Use Case 2, excepting that it will be much more typical - it will provide the schema in a separate file rather than as first line of the delimited data file.

Text editor view of your csv file:

text

Now the schema - same as before but in it's own file and pretty printed, more like a typical usage in your development envirnment.

json data

Calling it from the API

Once again, this shows how it is called from inside the tests:

    @Test
    public void testUseCase3() {
        DelimToAvro delimToAvro = new DelimToAvro();
        File targetFile = new File("target/deleteme.avro");
        File inputFile = new File("./src/test/resources/testFile3.csv");
        File schemaFile = new File("./src/test/resources/testFile7.avsc");
        delimToAvro.get(inputFile.toURI(), schemaFile.toURI(), targetFile, ",", false);
    }

What does it produce?

Once again, the data is encapsulated in an avro file.

Updated