File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
database-commons/src/main/java/io/cdap/plugin/db/batch/source Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 6363import java .util .List ;
6464import java .util .Properties ;
6565import java .util .regex .Pattern ;
66+ import java .util .stream .Collectors ;
6667import javax .annotation .Nullable ;
6768
6869/**
@@ -266,7 +267,12 @@ public void prepareRun(BatchSourceContext context) throws Exception {
266267 connectionConfigAccessor .setSchema (schemaStr );
267268 }
268269 LineageRecorder lineageRecorder = new LineageRecorder (context , sourceConfig .referenceName );
269- lineageRecorder .createExternalDataset (sourceConfig .getSchema ());
270+ Schema schema = sourceConfig .getSchema () == null ? schemaFromDB : sourceConfig .getSchema ();
271+ lineageRecorder .createExternalDataset (schema );
272+ if (schema != null && schema .getFields () != null ) {
273+ lineageRecorder .recordRead ("Read" , "Read from database plugin" ,
274+ schema .getFields ().stream ().map (Schema .Field ::getName ).collect (Collectors .toList ()));
275+ }
270276 context .setInput (Input .of (sourceConfig .referenceName , new SourceInputFormatProvider (
271277 DataDrivenETLDBInputFormat .class , connectionConfigAccessor .getConfiguration ())));
272278 }
You can’t perform that action at this time.
0 commit comments