Skip to content

Commit

Permalink
Add schema change attrs to connection create (#19771)
Browse files Browse the repository at this point in the history
* Add schema change attrs to connection create
  • Loading branch information
alovew authored Nov 29, 2022
1 parent 5755dd8 commit 8287362
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions airbyte-api/src/main/openapi/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3371,6 +3371,8 @@ components:
format: uuid
geography:
$ref: "#/components/schemas/Geography"
nonBreakingChangesPreference:
$ref: "#/components/schemas/NonBreakingChangesPreference"
ConnectionStateCreateOrUpdate:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.airbyte.config.ConfigSchema;
import io.airbyte.config.ConfigWithMetadata;
import io.airbyte.config.StandardSync;
import io.airbyte.config.StandardSync.NonBreakingChangesPreference;
import io.airbyte.config.helpers.ScheduleHelpers;
import io.airbyte.db.Database;
import io.airbyte.db.ExceptionWrappingDatabase;
Expand Down Expand Up @@ -240,6 +241,9 @@ private void writeStandardSync(final StandardSync standardSync, final DSLContext
.set(CONNECTION.GEOGRAPHY, Enums.toEnum(standardSync.getGeography().value(),
io.airbyte.db.instance.configs.jooq.generated.enums.GeographyType.class).orElseThrow())
.set(CONNECTION.BREAKING_CHANGE, standardSync.getBreakingChange())
.set(CONNECTION.NON_BREAKING_CHANGE_PREFERENCE,
standardSync.getNonBreakingChangesPreference() == null ? NonBreakingChangesPreference.IGNORE.value()
: standardSync.getNonBreakingChangesPreference().value())
.set(CONNECTION.CREATED_AT, timestamp)
.set(CONNECTION.UPDATED_AT, timestamp)
.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ public ConnectionRead createConnection(final ConnectionCreate connectionCreate)
.withStatus(ApiPojoConverters.toPersistenceStatus(connectionCreate.getStatus()))
.withSourceCatalogId(connectionCreate.getSourceCatalogId())
.withGeography(getGeographyFromConnectionCreateOrWorkspace(connectionCreate))
.withBreakingChange(false);
.withBreakingChange(false)
.withNonBreakingChangesPreference(
ApiPojoConverters.toPersistenceNonBreakingChangesPreference(connectionCreate.getNonBreakingChangesPreference()));
if (connectionCreate.getResourceRequirements() != null) {
standardSync.withResourceRequirements(ApiPojoConverters.resourceRequirementsToInternal(connectionCreate.getResourceRequirements()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ protected static ConnectionCreate toConnectionCreate(final WebBackendConnectionC
connectionCreate.resourceRequirements(webBackendConnectionCreate.getResourceRequirements());
connectionCreate.sourceCatalogId(webBackendConnectionCreate.getSourceCatalogId());
connectionCreate.geography(webBackendConnectionCreate.getGeography());
connectionCreate.nonBreakingChangesPreference(webBackendConnectionCreate.getNonBreakingChangesPreference());

return connectionCreate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ void testToConnectionCreate() throws IOException {
.schedule(schedule)
.syncCatalog(catalog)
.sourceCatalogId(sourceCatalogId)
.geography(Geography.US);
.geography(Geography.US)
.nonBreakingChangesPreference(NonBreakingChangesPreference.DISABLE);

final List<UUID> operationIds = List.of(newOperationId);

Expand All @@ -512,7 +513,8 @@ void testToConnectionCreate() throws IOException {
.schedule(schedule)
.syncCatalog(catalog)
.sourceCatalogId(sourceCatalogId)
.geography(Geography.US);
.geography(Geography.US)
.nonBreakingChangesPreference(NonBreakingChangesPreference.DISABLE);

final ConnectionCreate actual = WebBackendConnectionsHandler.toConnectionCreate(input, operationIds);

Expand Down
1 change: 1 addition & 0 deletions docs/reference/api/generated-api-html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12037,6 +12037,7 @@ <h3><a name="WebBackendConnectionCreate"><code>WebBackendConnectionCreate</code>
<div class="param">operations (optional)</div><div class="param-desc"><span class="param-type"><a href="#OperationCreate">array[OperationCreate]</a></span> </div>
<div class="param">sourceCatalogId (optional)</div><div class="param-desc"><span class="param-type"><a href="#UUID">UUID</a></span> format: uuid</div>
<div class="param">geography (optional)</div><div class="param-desc"><span class="param-type"><a href="#Geography">Geography</a></span> </div>
<div class="param">nonBreakingChangesPreference (optional)</div><div class="param-desc"><span class="param-type"><a href="#NonBreakingChangesPreference">NonBreakingChangesPreference</a></span> </div>
</div> <!-- field-items -->
</div>
<div class="model">
Expand Down
5 changes: 5 additions & 0 deletions tools/openapi2jsonschema/examples/airbyte.local/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,11 @@ components:
$ref: "#/components/schemas/ConnectionStatus"
syncCatalog:
$ref: "#/components/schemas/AirbyteCatalog"
nonBreakingChangesPreference:
enum:
- ignore
- disable
type: string
required:
- connection
- sourceId
Expand Down

0 comments on commit 8287362

Please sign in to comment.