|
16 | 16 | import io.airbyte.cdk.integrations.base.Destination;
|
17 | 17 | import io.airbyte.cdk.integrations.base.IntegrationRunner;
|
18 | 18 | import io.airbyte.cdk.integrations.base.ssh.SshWrappedDestination;
|
| 19 | +import io.airbyte.cdk.integrations.destination.PropertyNameSimplifyingDataTransformer; |
| 20 | +import io.airbyte.cdk.integrations.destination.async.deser.StreamAwareDataTransformer; |
19 | 21 | import io.airbyte.cdk.integrations.destination.jdbc.AbstractJdbcDestination;
|
| 22 | +import io.airbyte.cdk.integrations.destination.jdbc.typing_deduping.JdbcDestinationHandler; |
20 | 23 | import io.airbyte.cdk.integrations.destination.jdbc.typing_deduping.JdbcSqlGenerator;
|
21 | 24 | import io.airbyte.commons.exceptions.ConnectionErrorException;
|
22 | 25 | import io.airbyte.commons.json.Jsons;
|
23 | 26 | import io.airbyte.commons.map.MoreMaps;
|
| 27 | +import io.airbyte.integrations.base.destination.typing_deduping.DestinationHandler; |
| 28 | +import io.airbyte.integrations.base.destination.typing_deduping.ParsedCatalog; |
| 29 | +import io.airbyte.integrations.base.destination.typing_deduping.SqlGenerator; |
| 30 | +import io.airbyte.integrations.base.destination.typing_deduping.migrators.Migration; |
| 31 | +import io.airbyte.integrations.base.destination.typing_deduping.migrators.MinimumDestinationState; |
24 | 32 | import io.airbyte.integrations.destination.mysql.MySQLSqlOperations.VersionCompatibility;
|
25 | 33 | import io.airbyte.protocol.models.v0.AirbyteConnectionStatus;
|
26 | 34 | import io.airbyte.protocol.models.v0.AirbyteConnectionStatus.Status;
|
| 35 | +import java.util.Collections; |
| 36 | +import java.util.List; |
27 | 37 | import java.util.Map;
|
28 | 38 | import javax.sql.DataSource;
|
| 39 | +import org.jetbrains.annotations.NotNull; |
29 | 40 | import org.slf4j.Logger;
|
30 | 41 | import org.slf4j.LoggerFactory;
|
31 | 42 |
|
32 |
| -public class MySQLDestination extends AbstractJdbcDestination implements Destination { |
| 43 | +public class MySQLDestination extends AbstractJdbcDestination<MinimumDestinationState> implements Destination { |
33 | 44 |
|
34 | 45 | private static final Logger LOGGER = LoggerFactory.getLogger(MySQLDestination.class);
|
35 | 46 | public static final String DRIVER_CLASS = DatabaseDriver.MYSQL.getDriverClassName();
|
@@ -129,15 +140,37 @@ public JsonNode toJdbcConfig(final JsonNode config) {
|
129 | 140 | }
|
130 | 141 |
|
131 | 142 | @Override
|
132 |
| - protected JdbcSqlGenerator getSqlGenerator() { |
| 143 | + protected JdbcSqlGenerator getSqlGenerator(final JsonNode config) { |
133 | 144 | throw new UnsupportedOperationException("mysql does not yet support DV2");
|
134 | 145 | }
|
135 | 146 |
|
| 147 | + @Override |
| 148 | + protected StreamAwareDataTransformer getDataTransformer(ParsedCatalog parsedCatalog, String defaultNamespace) { |
| 149 | + return new PropertyNameSimplifyingDataTransformer(); |
| 150 | + } |
| 151 | + |
136 | 152 | public static void main(final String[] args) throws Exception {
|
137 | 153 | final Destination destination = MySQLDestination.sshWrappedDestination();
|
138 | 154 | LOGGER.info("starting destination: {}", MySQLDestination.class);
|
139 | 155 | new IntegrationRunner(destination).run(args);
|
140 | 156 | LOGGER.info("completed destination: {}", MySQLDestination.class);
|
141 | 157 | }
|
142 | 158 |
|
| 159 | + @NotNull |
| 160 | + @Override |
| 161 | + protected JdbcDestinationHandler<MinimumDestinationState> getDestinationHandler(@NotNull String databaseName, |
| 162 | + @NotNull JdbcDatabase database, |
| 163 | + @NotNull String rawTableSchema) { |
| 164 | + throw new UnsupportedOperationException("Mysql does not yet support DV2"); |
| 165 | + } |
| 166 | + |
| 167 | + @NotNull |
| 168 | + @Override |
| 169 | + protected List<Migration<MinimumDestinationState>> getMigrations(@NotNull JdbcDatabase database, |
| 170 | + @NotNull String databaseName, |
| 171 | + @NotNull SqlGenerator sqlGenerator, |
| 172 | + @NotNull DestinationHandler<MinimumDestinationState> destinationHandler) { |
| 173 | + return Collections.emptyList(); |
| 174 | + } |
| 175 | + |
143 | 176 | }
|
0 commit comments