21
21
import io .airbyte .cdk .integrations .destination .jdbc .AbstractJdbcDestination ;
22
22
import io .airbyte .cdk .integrations .destination .jdbc .typing_deduping .JdbcDestinationHandler ;
23
23
import io .airbyte .cdk .integrations .destination .jdbc .typing_deduping .JdbcSqlGenerator ;
24
+ import io .airbyte .cdk .integrations .destination .jdbc .typing_deduping .NoOpJdbcDestinationHandler ;
24
25
import io .airbyte .commons .exceptions .ConnectionErrorException ;
25
26
import io .airbyte .commons .json .Jsons ;
26
27
import io .airbyte .commons .map .MoreMaps ;
30
31
import io .airbyte .integrations .base .destination .typing_deduping .migrators .Migration ;
31
32
import io .airbyte .integrations .base .destination .typing_deduping .migrators .MinimumDestinationState ;
32
33
import io .airbyte .integrations .destination .mysql .MySQLSqlOperations .VersionCompatibility ;
34
+ import io .airbyte .integrations .destination .mysql .typing_deduping .MysqlSqlGenerator ;
33
35
import io .airbyte .protocol .models .v0 .AirbyteConnectionStatus ;
34
36
import io .airbyte .protocol .models .v0 .AirbyteConnectionStatus .Status ;
35
37
import java .util .Collections ;
36
38
import java .util .List ;
37
39
import java .util .Map ;
38
40
import javax .sql .DataSource ;
39
41
import org .jetbrains .annotations .NotNull ;
42
+ import org .jooq .SQLDialect ;
40
43
import org .slf4j .Logger ;
41
44
import org .slf4j .LoggerFactory ;
42
45
@@ -141,14 +144,24 @@ public JsonNode toJdbcConfig(final JsonNode config) {
141
144
142
145
@ Override
143
146
protected JdbcSqlGenerator getSqlGenerator (final JsonNode config ) {
144
- throw new UnsupportedOperationException ( "mysql does not yet support DV2" );
147
+ return new MysqlSqlGenerator ( );
145
148
}
146
149
147
150
@ Override
148
151
protected StreamAwareDataTransformer getDataTransformer (ParsedCatalog parsedCatalog , String defaultNamespace ) {
149
152
return new PropertyNameSimplifyingDataTransformer ();
150
153
}
151
154
155
+ @ Override
156
+ public boolean isV2Destination () {
157
+ return true ;
158
+ }
159
+
160
+ @ Override
161
+ protected boolean shouldAlwaysDisableTypeDedupe () {
162
+ return true ;
163
+ }
164
+
152
165
public static void main (final String [] args ) throws Exception {
153
166
final Destination destination = MySQLDestination .sshWrappedDestination ();
154
167
LOGGER .info ("starting destination: {}" , MySQLDestination .class );
@@ -161,7 +174,7 @@ public static void main(final String[] args) throws Exception {
161
174
protected JdbcDestinationHandler <MinimumDestinationState > getDestinationHandler (@ NotNull String databaseName ,
162
175
@ NotNull JdbcDatabase database ,
163
176
@ NotNull String rawTableSchema ) {
164
- throw new UnsupportedOperationException ( "Mysql does not yet support DV2" );
177
+ return new NoOpJdbcDestinationHandler <>( databaseName , database , rawTableSchema , SQLDialect . DEFAULT );
165
178
}
166
179
167
180
@ NotNull
0 commit comments