Skip to content

Commit

Permalink
Merge branch 'master' into grubberr/11092-normalization-snowflake-sup…
Browse files Browse the repository at this point in the history
…port-oauth
  • Loading branch information
etsybaev committed Mar 16, 2022
2 parents ef56c39 + 5b483db commit b557731
Show file tree
Hide file tree
Showing 55 changed files with 1,999 additions and 381 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.35.54-alpha
current_version = 0.35.55-alpha
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-[a-z]+)?
Expand Down
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


### SHARED ###
VERSION=0.35.54-alpha
VERSION=0.35.55-alpha

# When using the airbyte-db via default docker image
CONFIG_ROOT=/data
Expand Down
6 changes: 6 additions & 0 deletions airbyte-api/src/main/openapi/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2710,6 +2710,9 @@ components:
description: Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'.
default: null
example: "${SOURCE_NAMESPACE}"
name:
type: string
description: Name that will be set to this connection
prefix:
type: string
description: Prefix that will be prepended to the name of each stream when it is written to the destination.
Expand All @@ -2732,6 +2735,9 @@ components:
- syncCatalog
- status
properties:
name:
type: string
description: Name that will be set to the connection
connectionId:
$ref: "#/components/schemas/ConnectionId"
namespaceDefinition:
Expand Down
4 changes: 2 additions & 2 deletions airbyte-bootloader/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ ENV APPLICATION airbyte-bootloader

WORKDIR /app

ADD bin/${APPLICATION}-0.35.54-alpha.tar /app
ADD bin/${APPLICATION}-0.35.55-alpha.tar /app

ENTRYPOINT ["/bin/bash", "-c", "${APPLICATION}-0.35.54-alpha/bin/${APPLICATION}"]
ENTRYPOINT ["/bin/bash", "-c", "${APPLICATION}-0.35.55-alpha/bin/${APPLICATION}"]
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void testBootloaderAppBlankDb() throws Exception {
mockedConfigs.getConfigDatabaseUrl())
.getAndInitialize();
val configsMigrator = new ConfigsDatabaseMigrator(configDatabase, this.getClass().getName());
assertEquals("0.35.46.001", configsMigrator.getLatestMigration().getVersion().getVersion());
assertEquals("0.35.54.001", configsMigrator.getLatestMigration().getVersion().getVersion());

val jobsPersistence = new DefaultJobPersistence(jobDatabase);
assertEquals(version, jobsPersistence.getVersion().get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
- name: HubSpot
sourceDefinitionId: 36c891d9-4bd9-43ac-bad2-10e12756272c
dockerRepository: airbyte/source-hubspot
dockerImageTag: 0.1.46
dockerImageTag: 0.1.47
documentationUrl: https://docs.airbyte.io/integrations/sources/hubspot
icon: hubspot.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3331,7 +3331,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-hubspot:0.1.46"
- dockerImage: "airbyte/source-hubspot:0.1.47"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/sources/hubspot"
connectionSpecification:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1668,17 +1668,17 @@ public Map<String, Stream<JsonNode>> dumpConfigs() throws IOException {
.map(Jsons::jsonNode));
}
final List<ConfigWithMetadata<ActorCatalog>> actorCatalogWithMetadata = listActorCatalogWithMetadata();
if (!standardSyncStateWithMetadata.isEmpty()) {
if (!actorCatalogWithMetadata.isEmpty()) {
result.put(ConfigSchema.ACTOR_CATALOG.name(),
standardSyncStateWithMetadata
actorCatalogWithMetadata
.stream()
.map(ConfigWithMetadata::getConfig)
.map(Jsons::jsonNode));
}
final List<ConfigWithMetadata<ActorCatalogFetchEvent>> actorCatalogFetchEventWithMetadata = listActorCatalogFetchEventWithMetadata();
if (!standardSyncStateWithMetadata.isEmpty()) {
if (!actorCatalogFetchEventWithMetadata.isEmpty()) {
result.put(ConfigSchema.ACTOR_CATALOG_FETCH_EVENT.name(),
standardSyncStateWithMetadata
actorCatalogFetchEventWithMetadata
.stream()
.map(ConfigWithMetadata::getConfig)
.map(Jsons::jsonNode));
Expand Down
6 changes: 3 additions & 3 deletions airbyte-container-orchestrator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] htt
RUN apt-get update && apt-get install -y kubectl

ENV APPLICATION airbyte-container-orchestrator
ENV AIRBYTE_ENTRYPOINT "/app/${APPLICATION}-0.35.54-alpha/bin/${APPLICATION}"
ENV AIRBYTE_ENTRYPOINT "/app/${APPLICATION}-0.35.55-alpha/bin/${APPLICATION}"

WORKDIR /app

# Move orchestrator app
ADD bin/${APPLICATION}-0.35.54-alpha.tar /app
ADD bin/${APPLICATION}-0.35.55-alpha.tar /app

# wait for upstream dependencies to become available before starting server
ENTRYPOINT ["/bin/bash", "-c", "/app/${APPLICATION}-0.35.54-alpha/bin/${APPLICATION}"]
ENTRYPOINT ["/bin/bash", "-c", "/app/${APPLICATION}-0.35.55-alpha/bin/${APPLICATION}"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright (c) 2021 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.db.instance.configs.migrations;

import static org.jooq.impl.DSL.asterisk;
import static org.jooq.impl.DSL.table;

import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.jooq.DSLContext;
import org.jooq.Field;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class V0_35_54_001__ChangeDefaultConnectionName extends BaseJavaMigration {

private static final Logger LOGGER = LoggerFactory.getLogger(V0_35_54_001__ChangeDefaultConnectionName.class);

public static void defaultConnectionName(final DSLContext ctx) {
LOGGER.info("Updating connection name column");
final Field<UUID> id = DSL.field("id", SQLDataType.UUID.nullable(false));
final Field<String> name = DSL.field("name", SQLDataType.VARCHAR(256).nullable(false));
List<Connection> connections = getConnections(ctx);

for (final Connection connection : connections) {
final Actor sourceActor = getActor(connection.getSourceId(), ctx);
final Actor destinationActor = getActor(connection.getDestinationId(), ctx);
final String connectionName = sourceActor.getName() + " <> " + destinationActor.getName();

ctx.update(DSL.table("connection"))
.set(name, connectionName)
.where(id.eq(connection.getConnectionId()))
.execute();
}
}

static <T> List<Connection> getConnections(final DSLContext ctx) {
LOGGER.info("Get connections having name default");
final Field<String> name = DSL.field("name", SQLDataType.VARCHAR(36).nullable(false));
final Field<UUID> id = DSL.field("id", SQLDataType.UUID.nullable(false));
final Field<UUID> sourceId = DSL.field("source_id", SQLDataType.UUID.nullable(false));
final Field<UUID> destinationId = DSL.field("destination_id", SQLDataType.UUID.nullable(false));

final Field<String> connectionName = DSL.field("name", SQLDataType.VARCHAR(256).nullable(false));
final Result<Record> results = ctx.select(asterisk()).from(table("connection")).where(connectionName.eq("default")).fetch();

return results.stream().map(record -> new Connection(
record.get(name),
record.get(id),
record.get(sourceId),
record.get(destinationId)))
.collect(Collectors.toList());
}

static <T> Actor getActor(final UUID actorDefinitionId, final DSLContext ctx) {
final Field<String> name = DSL.field("name", SQLDataType.VARCHAR(36).nullable(false));
final Field<UUID> id = DSL.field("id", SQLDataType.UUID.nullable(false));

final Result<Record> results = ctx.select(asterisk()).from(table("actor")).where(id.eq(actorDefinitionId)).fetch();

return results.stream()
.map(record -> new Actor(record.get(name))).toList().get(0);
}

@Override
public void migrate(final Context context) throws Exception {
LOGGER.info("Running migration: {}", this.getClass().getSimpleName());

final DSLContext ctx = DSL.using(context.getConnection());
defaultConnectionName(ctx);
}

public static class Actor {

private final String name;

public <T> Actor(String name) {
this.name = name;
}

public String getName() {
return this.name;
}

}

public static class Connection {

private final String name;
private final UUID connectionId;
private final UUID sourceId;
private final UUID destinationId;

public <T> Connection(String name, UUID id, UUID sourceId, UUID destinationId) {
this.name = name;
this.connectionId = id;
this.sourceId = sourceId;
this.destinationId = destinationId;
}

public String getName() {
return this.name;
}

public UUID getSourceId() {
return this.sourceId;
}

public UUID getDestinationId() {
return this.destinationId;
}

public UUID getConnectionId() {
return this.connectionId;
}

}

}
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-hubspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ COPY source_hubspot ./source_hubspot
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.46
LABEL io.airbyte.version=0.1.47
LABEL io.airbyte.name=airbyte/source-hubspot
Loading

0 comments on commit b557731

Please sign in to comment.