|
24 | 24 | import io.cdap.cdap.api.annotation.MetadataProperty; |
25 | 25 | import io.cdap.cdap.api.annotation.Name; |
26 | 26 | import io.cdap.cdap.api.annotation.Plugin; |
| 27 | +import io.cdap.cdap.api.data.batch.Output; |
27 | 28 | import io.cdap.cdap.api.data.format.StructuredRecord; |
28 | 29 | import io.cdap.cdap.api.data.schema.Schema; |
29 | 30 | import io.cdap.cdap.etl.api.FailureCollector; |
|
34 | 35 | import io.cdap.plugin.common.Asset; |
35 | 36 | import io.cdap.plugin.common.ConfigUtil; |
36 | 37 | import io.cdap.plugin.common.LineageRecorder; |
| 38 | +import io.cdap.plugin.common.batch.sink.SinkOutputFormatProvider; |
37 | 39 | import io.cdap.plugin.db.DBRecord; |
38 | 40 | import io.cdap.plugin.db.SchemaReader; |
39 | 41 | import io.cdap.plugin.db.config.AbstractDBSpecificSinkConfig; |
40 | 42 | import io.cdap.plugin.db.sink.AbstractDBSink; |
41 | 43 | import io.cdap.plugin.db.sink.FieldsValidator; |
42 | 44 | import io.cdap.plugin.postgres.PostgresDBRecord; |
| 45 | +import io.cdap.plugin.postgres.PostgresETLDBOutputFormat; |
43 | 46 | import io.cdap.plugin.postgres.PostgresFieldsValidator; |
44 | 47 | import io.cdap.plugin.postgres.PostgresSchemaReader; |
45 | 48 | import io.cdap.plugin.util.CloudSQLUtil; |
@@ -88,10 +91,17 @@ public void configurePipeline(PipelineConfigurer pipelineConfigurer) { |
88 | 91 | protected SchemaReader getSchemaReader() { |
89 | 92 | return new PostgresSchemaReader(); |
90 | 93 | } |
| 94 | + @Override |
| 95 | + protected void addOutputContext(BatchSinkContext context) { |
| 96 | + context.addOutput(Output.of(cloudsqlPostgresqlSinkConfig.getReferenceName(), |
| 97 | + new SinkOutputFormatProvider(PostgresETLDBOutputFormat.class, |
| 98 | + getConfiguration()))); |
| 99 | + } |
91 | 100 |
|
92 | 101 | @Override |
93 | 102 | protected DBRecord getDBRecord(StructuredRecord output) { |
94 | | - return new PostgresDBRecord(output, columnTypes); |
| 103 | + return new PostgresDBRecord(output, columnTypes, cloudsqlPostgresqlSinkConfig.getOperationName(), |
| 104 | + cloudsqlPostgresqlSinkConfig.getRelationTableKey()); |
95 | 105 | } |
96 | 106 |
|
97 | 107 | @Override |
|
0 commit comments