-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Discover worker starts to use API to write schema result (#21875)
* api changes for writing discover catalog * api changes * format * worker change 1 * change return type of the API to return catalogId * worker to call api * typo * 🎉 Source GoogleSheets - migrated SAT to strictness level (#21399) * migrated SAT to strictness level * fixed expected records * revert file from another source * changed extension to txt * changed extension to txt * 🐛Destination-Bigquery: Added an explicit error message if sync fails due to a config issue (#21144) * [19998] Destination-Bigquery: Added an explicit error message in sync fails due to a config issue * ci-connector-ops: split workflows(#21474) * CI: nightly build alpha sources and destinations (#21562) * Revert "Change main class in strict-encrypt destination and bump versions on both destinations to keep them in sync (#21509)" (#21567) This reverts commit 1d202d1. * Fixes webhook updating logic (#21519) * ci_credentials: disable tooling test run by tox (#21580) * disable tox * rename steps * revert changes on experimental workflow * do not install tox * Revert "CI: nightly build alpha sources and destinations (#21562)" (#21589) This reverts commit 61f88f3. * Security update of default docker images (#21407) Because there is a lot of CVEs in those releases. Co-authored-by: Topher Lubaway <asimplechris@gmail.com> * 📝 add docs for how to add normalization (#21563) * add docs * add schema link * update based on feedback * 🪟 🚦 E2E tests: clean up matchers (#20887) * improve serviceTypeDropdownOption selector * add test ids to PathPopout component(s) * add unique id's to table dropdowns * extend submitButtonClick to support optional click options * update dropdown(pathPopout) matchers * add test-id to Overlay component * remove redundant function brackets * revert changes onSubmit button click * fix dropDown overlay issue * move all duplicated intercepters to beforeEach * add test id's to Connections, Sources and Destinations tables * add table helper functions * update source page actions * intercepter fixes * update createTestConnection function with optional replication settings * remove extra Connection name check * replace "cypress-postgres" with "pg-promise" npm package * update cypress config * Revert "update createTestConnection function with optional replication settings" This reverts commit 8e47c78. * Revert "remove extra Connection name check" This reverts commit dfb19c7. * replace openSourceDestinationFromGrid with specific selector * replace openSourceDestinationFromGrid with specific selector * turn on test * add test-id's * fix selectors * update test * update test snapshots * fix lost data-testid after resolve merge conflicts * remove extra check * move clickOnCellInTable helper to common.ts file * remove empty line and comments * fix dropdownType * replace partial string check with exact * extract interceptors and waiters to separate file * fix selector for predefined PK * fix selector * add comment regarding dropdown * 🪟 🎨 [Free connectors] Update modal copy (#21600) * move start/end time options out of optional block (#21541) * lingering fix * reflecting api changes * test fix * worker to call api to do discover work * recovered deleted html * self review * more converters refactor * fix connector test * fix test * fix * fix integration test * add unit test for converter * static fix * api client needs to have a timeout in case request does not get responded --------- Co-authored-by: midavadim <midavadim@yahoo.com> Co-authored-by: Eugene <etsybaev@gmail.com> Co-authored-by: Augustin <augustin@airbyte.io> Co-authored-by: Greg Solovyev <grishick@users.noreply.github.com> Co-authored-by: Yatsuk Bogdan <yatsukbogdan@gmail.com> Co-authored-by: Hervé Commowick <github@herve.commowick.fr> Co-authored-by: Topher Lubaway <asimplechris@gmail.com> Co-authored-by: Pedro S. Lopez <pedroslopez@me.com> Co-authored-by: Vladimir <volodymyr.s.petrov@globallogic.com> Co-authored-by: Joey Marshment-Howell <josephkmh@users.noreply.github.com> Co-authored-by: Lake Mossman <lake@airbyte.io>
- Loading branch information
1 parent
0cef7b0
commit 36698ce
Showing
9 changed files
with
225 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
airbyte-commons-worker/src/main/java/io/airbyte/workers/helper/CatalogClientConverters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.workers.helper; | ||
|
||
import io.airbyte.commons.enums.Enums; | ||
import io.airbyte.commons.text.Names; | ||
import io.airbyte.protocol.models.AirbyteStream; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Utilities to convert Catalog protocol to Catalog API client. This class was similar to existing | ||
* logic in CatalogConverter.java; But code can't be shared because the protocol model is | ||
* essentially converted to two different api models. Thus, if we need to change logic on either | ||
* place we have to take care of the other one too. | ||
*/ | ||
public class CatalogClientConverters { | ||
|
||
/** | ||
* Converts a protocol AirbyteCatalog to an OpenAPI client versioned AirbyteCatalog. | ||
*/ | ||
public static io.airbyte.api.client.model.generated.AirbyteCatalog toAirbyteCatalogClientApi( | ||
final io.airbyte.protocol.models.AirbyteCatalog catalog) { | ||
return new io.airbyte.api.client.model.generated.AirbyteCatalog() | ||
.streams(catalog.getStreams() | ||
.stream() | ||
.map(stream -> toAirbyteStreamClientApi(stream)) | ||
.map(s -> new io.airbyte.api.client.model.generated.AirbyteStreamAndConfiguration() | ||
.stream(s) | ||
.config(generateDefaultConfiguration(s))) | ||
.collect(Collectors.toList())); | ||
} | ||
|
||
private static io.airbyte.api.client.model.generated.AirbyteStreamConfiguration generateDefaultConfiguration( | ||
final io.airbyte.api.client.model.generated.AirbyteStream stream) { | ||
final io.airbyte.api.client.model.generated.AirbyteStreamConfiguration result = | ||
new io.airbyte.api.client.model.generated.AirbyteStreamConfiguration() | ||
.aliasName(Names.toAlphanumericAndUnderscore(stream.getName())) | ||
.cursorField(stream.getDefaultCursorField()) | ||
.destinationSyncMode(io.airbyte.api.client.model.generated.DestinationSyncMode.APPEND) | ||
.primaryKey(stream.getSourceDefinedPrimaryKey()) | ||
.selected(true); | ||
if (stream.getSupportedSyncModes().size() > 0) { | ||
result.setSyncMode(Enums.convertTo(stream.getSupportedSyncModes().get(0), | ||
io.airbyte.api.client.model.generated.SyncMode.class)); | ||
} else { | ||
result.setSyncMode(io.airbyte.api.client.model.generated.SyncMode.INCREMENTAL); | ||
} | ||
return result; | ||
} | ||
|
||
private static io.airbyte.api.client.model.generated.AirbyteStream toAirbyteStreamClientApi( | ||
final AirbyteStream stream) { | ||
return new io.airbyte.api.client.model.generated.AirbyteStream() | ||
.name(stream.getName()) | ||
.jsonSchema(stream.getJsonSchema()) | ||
.supportedSyncModes(Enums.convertListTo(stream.getSupportedSyncModes(), | ||
io.airbyte.api.client.model.generated.SyncMode.class)) | ||
.sourceDefinedCursor(stream.getSourceDefinedCursor()) | ||
.defaultCursorField(stream.getDefaultCursorField()) | ||
.sourceDefinedPrimaryKey(stream.getSourceDefinedPrimaryKey()) | ||
.namespace(stream.getNamespace()); | ||
} | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
...e-commons-worker/src/test/java/io/airbyte/workers/helper/CatalogClientConvertersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.workers.helper; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import com.google.common.collect.Lists; | ||
import io.airbyte.commons.text.Names; | ||
import io.airbyte.protocol.models.AirbyteCatalog; | ||
import io.airbyte.protocol.models.AirbyteStream; | ||
import io.airbyte.protocol.models.CatalogHelpers; | ||
import io.airbyte.protocol.models.Field; | ||
import io.airbyte.protocol.models.JsonSchemaType; | ||
import io.airbyte.protocol.models.SyncMode; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class CatalogClientConvertersTest { | ||
|
||
public static final String ID_FIELD_NAME = "id"; | ||
private static final String STREAM_NAME = "users-data"; | ||
private static final AirbyteStream STREAM = new AirbyteStream() | ||
.withName(STREAM_NAME) | ||
.withJsonSchema( | ||
CatalogHelpers.fieldsToJsonSchema(Field.of(ID_FIELD_NAME, JsonSchemaType.STRING))) | ||
.withDefaultCursorField(Lists.newArrayList(ID_FIELD_NAME)) | ||
.withSourceDefinedCursor(false) | ||
.withSourceDefinedPrimaryKey(Collections.emptyList()) | ||
.withSupportedSyncModes(List.of(SyncMode.FULL_REFRESH, SyncMode.INCREMENTAL)); | ||
|
||
private static final io.airbyte.api.client.model.generated.AirbyteStream CLIENT_STREAM = | ||
new io.airbyte.api.client.model.generated.AirbyteStream() | ||
.name(STREAM_NAME) | ||
.jsonSchema(CatalogHelpers.fieldsToJsonSchema(Field.of(ID_FIELD_NAME, JsonSchemaType.STRING))) | ||
.defaultCursorField(Lists.newArrayList(ID_FIELD_NAME)) | ||
.sourceDefinedCursor(false) | ||
.sourceDefinedPrimaryKey(Collections.emptyList()) | ||
.supportedSyncModes(List.of(io.airbyte.api.client.model.generated.SyncMode.FULL_REFRESH, | ||
io.airbyte.api.client.model.generated.SyncMode.INCREMENTAL)); | ||
private static final io.airbyte.api.client.model.generated.AirbyteStreamConfiguration CLIENT_DEFAULT_STREAM_CONFIGURATION = | ||
new io.airbyte.api.client.model.generated.AirbyteStreamConfiguration() | ||
.syncMode(io.airbyte.api.client.model.generated.SyncMode.FULL_REFRESH) | ||
.cursorField(Lists.newArrayList(ID_FIELD_NAME)) | ||
.destinationSyncMode(io.airbyte.api.client.model.generated.DestinationSyncMode.APPEND) | ||
.primaryKey(Collections.emptyList()) | ||
.aliasName(Names.toAlphanumericAndUnderscore(STREAM_NAME)) | ||
.selected(true); | ||
|
||
private static final AirbyteCatalog BASIC_MODEL_CATALOG = new AirbyteCatalog().withStreams( | ||
Lists.newArrayList(STREAM)); | ||
|
||
private static final io.airbyte.api.client.model.generated.AirbyteCatalog EXPECTED_CLIENT_CATALOG = | ||
new io.airbyte.api.client.model.generated.AirbyteCatalog() | ||
.streams(Lists.newArrayList( | ||
new io.airbyte.api.client.model.generated.AirbyteStreamAndConfiguration() | ||
.stream(CLIENT_STREAM) | ||
.config(CLIENT_DEFAULT_STREAM_CONFIGURATION))); | ||
|
||
@Test | ||
void testConvertToClientAPI() { | ||
assertEquals(EXPECTED_CLIENT_CATALOG, | ||
CatalogClientConverters.toAirbyteCatalogClientApi(BASIC_MODEL_CATALOG)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.