Search in sources :

Example 1 with TablePreviewPrinter

use of org.embulk.command.TablePreviewPrinter in project embulk by embulk.

the class EmbulkRunner method previewInternal.

private void previewInternal(final ConfigSource configSource, final String format) throws IOException {
    final PreviewResult previewResult = this.embed.preview(configSource);
    final ModelManager modelManager = this.embed.getModelManager();
    final PreviewPrinter printer;
    switch(format != null ? format : "table") {
        case "table":
            printer = new TablePreviewPrinter(System.out, modelManager, previewResult.getSchema());
            break;
        case "vertical":
            printer = new VerticalPreviewPrinter(System.out, modelManager, previewResult.getSchema());
            break;
        default:
            throw new IllegalArgumentException("Unknown preview output format '" + format + "'. Supported formats: table, vertical");
    }
    printer.printAllPages(previewResult.getPages());
    printer.finish();
}
Also used : PreviewResult(org.embulk.exec.PreviewResult) VerticalPreviewPrinter(org.embulk.command.VerticalPreviewPrinter) TablePreviewPrinter(org.embulk.command.TablePreviewPrinter) VerticalPreviewPrinter(org.embulk.command.VerticalPreviewPrinter) PreviewPrinter(org.embulk.command.PreviewPrinter) TablePreviewPrinter(org.embulk.command.TablePreviewPrinter) ModelManager(org.embulk.config.ModelManager)

Aggregations

PreviewPrinter (org.embulk.command.PreviewPrinter)1 TablePreviewPrinter (org.embulk.command.TablePreviewPrinter)1 VerticalPreviewPrinter (org.embulk.command.VerticalPreviewPrinter)1 ModelManager (org.embulk.config.ModelManager)1 PreviewResult (org.embulk.exec.PreviewResult)1