Skip to content

Commit 5cdedf6

Browse files
committed
Merge branch 'master' into etsybaev/9525-source-redshift-add-schema-selection
2 parents a537304 + a6a7ee5 commit 5cdedf6

File tree

85 files changed

+1561
-150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1561
-150
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.35.9-alpha
2+
current_version = 0.35.10-alpha
33
commit = False
44
tag = False
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-[a-z]+)?

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
### SHARED ###
13-
VERSION=0.35.9-alpha
13+
VERSION=0.35.10-alpha
1414

1515
# When using the airbyte-db via default docker image
1616
CONFIG_ROOT=/data

airbyte-bootloader/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ ENV APPLICATION airbyte-bootloader
55

66
WORKDIR /app
77

8-
ADD bin/${APPLICATION}-0.35.9-alpha.tar /app
8+
ADD bin/${APPLICATION}-0.35.10-alpha.tar /app
99

10-
ENTRYPOINT ["/bin/bash", "-c", "${APPLICATION}-0.35.9-alpha/bin/${APPLICATION}"]
10+
ENTRYPOINT ["/bin/bash", "-c", "${APPLICATION}-0.35.10-alpha/bin/${APPLICATION}"]

airbyte-config/init/src/main/java/io/airbyte/config/init/YamlSeedConfigPersistence.java

+6
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ public <T> List<T> listConfigs(final AirbyteConfig configType, final Class<T> cl
119119
return configs.values().stream().map(json -> Jsons.object(json, clazz)).collect(Collectors.toList());
120120
}
121121

122+
@Override
123+
public <T> ConfigWithMetadata<T> getConfigWithMetadata(final AirbyteConfig configType, final String configId, final Class<T> clazz)
124+
throws ConfigNotFoundException, JsonValidationException, IOException {
125+
throw new UnsupportedOperationException("Yaml Seed Config doesn't support metadata");
126+
}
127+
122128
@Override
123129
public <T> List<ConfigWithMetadata<T>> listConfigsWithMetadata(final AirbyteConfig configType, final Class<T> clazz)
124130
throws JsonValidationException, IOException {

airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/36c891d9-4bd9-43ac-bad2-10e12756272c.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceDefinitionId": "36c891d9-4bd9-43ac-bad2-10e12756272c",
33
"name": "HubSpot",
44
"dockerRepository": "airbyte/source-hubspot",
5-
"dockerImageTag": "0.1.35",
5+
"dockerImageTag": "0.1.36",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/hubspot",
77
"icon": "hubspot.svg"
88
}

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
- name: Google Analytics
253253
sourceDefinitionId: eff3616a-f9c3-11eb-9a03-0242ac130003
254254
dockerRepository: airbyte/source-google-analytics-v4
255-
dockerImageTag: 0.1.15
255+
dockerImageTag: 0.1.16
256256
documentationUrl: https://docs.airbyte.io/integrations/sources/google-analytics-v4
257257
icon: google-analytics.svg
258258
sourceType: api
@@ -307,7 +307,7 @@
307307
- name: HubSpot
308308
sourceDefinitionId: 36c891d9-4bd9-43ac-bad2-10e12756272c
309309
dockerRepository: airbyte/source-hubspot
310-
dockerImageTag: 0.1.35
310+
dockerImageTag: 0.1.36
311311
documentationUrl: https://docs.airbyte.io/integrations/sources/hubspot
312312
icon: hubspot.svg
313313
sourceType: api

airbyte-config/init/src/main/resources/seed/source_specs.yaml

+19-4
Original file line numberDiff line numberDiff line change
@@ -2449,7 +2449,7 @@
24492449
oauthFlowOutputParameters:
24502450
- - "access_token"
24512451
- - "refresh_token"
2452-
- dockerImage: "airbyte/source-google-analytics-v4:0.1.15"
2452+
- dockerImage: "airbyte/source-google-analytics-v4:0.1.16"
24532453
spec:
24542454
documentationUrl: "https://docs.airbyte.io/integrations/sources/google-analytics-v4"
24552455
connectionSpecification:
@@ -2476,6 +2476,20 @@
24762476
\ will not be replicated."
24772477
examples:
24782478
- "2020-06-01"
2479+
window_in_days:
2480+
type: "integer"
2481+
title: "Window in days"
2482+
description: "The amount of days for each data-chunk beginning from start_date.\
2483+
\ Bigger the value - faster the fetch. (Min=1, as for a Day; Max=364,\
2484+
\ as for a Year)."
2485+
examples:
2486+
- 30
2487+
- 60
2488+
- 90
2489+
- 120
2490+
- 200
2491+
- 364
2492+
default: 1
24792493
custom_reports:
24802494
order: 3
24812495
type: "string"
@@ -2487,6 +2501,7 @@
24872501
order: 0
24882502
type: "object"
24892503
title: "Credentials"
2504+
description: "Credentials for the service"
24902505
oneOf:
24912506
- title: "Authenticate via Google (Oauth)"
24922507
type: "object"
@@ -3067,7 +3082,7 @@
30673082
supportsNormalization: false
30683083
supportsDBT: false
30693084
supported_destination_sync_modes: []
3070-
- dockerImage: "airbyte/source-hubspot:0.1.35"
3085+
- dockerImage: "airbyte/source-hubspot:0.1.36"
30713086
spec:
30723087
documentationUrl: "https://docs.airbyte.io/integrations/sources/hubspot"
30733088
connectionSpecification:
@@ -4217,7 +4232,7 @@
42174232
supportsNormalization: false
42184233
supportsDBT: false
42194234
supported_destination_sync_modes: []
4220-
- dockerImage: "airbyte/source-mssql:0.3.13"
4235+
- dockerImage: "airbyte/source-mssql:0.3.14"
42214236
spec:
42224237
documentationUrl: "https://docs.airbyte.io/integrations/destinations/mssql"
42234238
connectionSpecification:
@@ -5895,7 +5910,7 @@
58955910
supportsNormalization: false
58965911
supportsDBT: false
58975912
supported_destination_sync_modes: []
5898-
- dockerImage: "airbyte/source-postgres:0.4.2"
5913+
- dockerImage: "airbyte/source-postgres:0.4.3"
58995914
spec:
59005915
documentationUrl: "https://docs.airbyte.io/integrations/sources/postgres"
59015916
connectionSpecification:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
"$schema": http://json-schema.org/draft-07/schema#
3+
"$id": https://github.com/airbytehq/airbyte/blob/master/airbyte-config/models/src/main/resources/types/AttemptFailureSummary.yaml
4+
title: AttemptFailureSummary
5+
description: Attempt-level summarization of failures that occurred during a sync workflow.
6+
type: object
7+
additionalProperties: false
8+
required:
9+
- failures
10+
properties:
11+
failures:
12+
description: Ordered list of failures that occurred during the attempt.
13+
type: array
14+
items:
15+
"$ref": FailureReason.yaml
16+
partialSuccess:
17+
description: True if the number of committed records for this attempt was greater than 0. False if 0 records were committed.
18+
type: boolean
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
"$schema": http://json-schema.org/draft-07/schema#
3+
"$id": https://github.com/airbytehq/airbyte/blob/master/airbyte-config/models/src/main/resources/types/FailureReason.yaml
4+
title: FailureSummary
5+
type: object
6+
required:
7+
- failureOrigin
8+
- timestamp
9+
additionalProperties: false
10+
properties:
11+
failureOrigin:
12+
description: Indicates where the error originated. If not set, the origin of error is not well known.
13+
type: string
14+
enum:
15+
- unknown
16+
- source
17+
- destination
18+
- replicationWorker
19+
- persistence
20+
- normalization
21+
- dbt
22+
failureType:
23+
description: Categorizes well known errors into types for programmatic handling. If not set, the type of error is not well known.
24+
type: string
25+
enum:
26+
- unknown
27+
- userError
28+
- systemError
29+
- transient
30+
internalMessage:
31+
description: Human readable failure description for consumption by technical system operators, like Airbyte engineers or OSS users.
32+
type: string
33+
externalMessage:
34+
description: Human readable failure description for presentation in the UI to non-technical users.
35+
type: string
36+
metadata:
37+
description: Key-value pairs of relevant data
38+
type: object
39+
additionalProperties: true
40+
stacktrace:
41+
description: Raw stacktrace associated with the failure.
42+
type: string
43+
timestamp:
44+
type: integer

airbyte-config/models/src/main/resources/types/ReplicationOutput.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ properties:
1616
"$ref": State.yaml
1717
output_catalog:
1818
existingJavaType: io.airbyte.protocol.models.ConfiguredAirbyteCatalog
19+
failures:
20+
type: array
21+
items:
22+
"$ref": FailureReason.yaml

airbyte-config/models/src/main/resources/types/StandardSyncOutput.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ properties:
1616
"$ref": State.yaml
1717
output_catalog:
1818
existingJavaType: io.airbyte.protocol.models.ConfiguredAirbyteCatalog
19+
failures:
20+
type: array
21+
items:
22+
"$ref": FailureReason.yaml

airbyte-config/persistence/src/main/java/io/airbyte/config/persistence/ConfigPersistence.java

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public interface ConfigPersistence {
1919

2020
<T> List<T> listConfigs(AirbyteConfig configType, Class<T> clazz) throws JsonValidationException, IOException;
2121

22+
<T> ConfigWithMetadata<T> getConfigWithMetadata(AirbyteConfig configType, String configId, Class<T> clazz)
23+
throws ConfigNotFoundException, JsonValidationException, IOException;
24+
2225
<T> List<ConfigWithMetadata<T>> listConfigsWithMetadata(AirbyteConfig configType, Class<T> clazz) throws JsonValidationException, IOException;
2326

2427
<T> void writeConfig(AirbyteConfig configType, String configId, T config) throws JsonValidationException, IOException;

airbyte-config/persistence/src/main/java/io/airbyte/config/persistence/DatabaseConfigPersistence.java

+40-3
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private StandardDestinationDefinition getStandardDestinationDefinition(final Str
139139
return result.get(0).getConfig();
140140
}
141141

142-
private SourceConnection getSourceConnection(String configId) throws IOException, ConfigNotFoundException {
142+
private SourceConnection getSourceConnection(final String configId) throws IOException, ConfigNotFoundException {
143143
final List<ConfigWithMetadata<SourceConnection>> result = listSourceConnectionWithMetadata(Optional.of(UUID.fromString(configId)));
144144
validate(configId, result, ConfigSchema.SOURCE_CONNECTION);
145145
return result.get(0).getConfig();
@@ -188,7 +188,7 @@ private List<UUID> connectionOperationIds(final UUID connectionId) throws IOExce
188188
.fetch());
189189

190190
final List<UUID> ids = new ArrayList<>();
191-
for (Record record : result) {
191+
for (final Record record : result) {
192192
ids.add(record.get(CONNECTION_OPERATION.OPERATION_ID));
193193
}
194194

@@ -204,13 +204,50 @@ private <T> void validate(final String configId, final List<ConfigWithMetadata<T
204204
}
205205
}
206206

207+
private <T> ConfigWithMetadata<T> validateAndReturn(final String configId,
208+
final List<ConfigWithMetadata<T>> result,
209+
final AirbyteConfig airbyteConfig)
210+
throws ConfigNotFoundException {
211+
validate(configId, result, airbyteConfig);
212+
return result.get(0);
213+
}
214+
207215
@Override
208216
public <T> List<T> listConfigs(final AirbyteConfig configType, final Class<T> clazz) throws JsonValidationException, IOException {
209217
final List<T> config = new ArrayList<>();
210218
listConfigsWithMetadata(configType, clazz).forEach(c -> config.add(c.getConfig()));
211219
return config;
212220
}
213221

222+
@Override
223+
public <T> ConfigWithMetadata<T> getConfigWithMetadata(final AirbyteConfig configType, final String configId, final Class<T> clazz)
224+
throws ConfigNotFoundException, JsonValidationException, IOException {
225+
final Optional<UUID> configIdOpt = Optional.of(UUID.fromString(configId));
226+
if (configType == ConfigSchema.STANDARD_WORKSPACE) {
227+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listStandardWorkspaceWithMetadata(configIdOpt), configType);
228+
} else if (configType == ConfigSchema.STANDARD_SOURCE_DEFINITION) {
229+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listStandardSourceDefinitionWithMetadata(configIdOpt), configType);
230+
} else if (configType == ConfigSchema.STANDARD_DESTINATION_DEFINITION) {
231+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listStandardDestinationDefinitionWithMetadata(configIdOpt), configType);
232+
} else if (configType == ConfigSchema.SOURCE_CONNECTION) {
233+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listSourceConnectionWithMetadata(configIdOpt), configType);
234+
} else if (configType == ConfigSchema.DESTINATION_CONNECTION) {
235+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listDestinationConnectionWithMetadata(configIdOpt), configType);
236+
} else if (configType == ConfigSchema.SOURCE_OAUTH_PARAM) {
237+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listSourceOauthParamWithMetadata(configIdOpt), configType);
238+
} else if (configType == ConfigSchema.DESTINATION_OAUTH_PARAM) {
239+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listDestinationOauthParamWithMetadata(configIdOpt), configType);
240+
} else if (configType == ConfigSchema.STANDARD_SYNC_OPERATION) {
241+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listStandardSyncOperationWithMetadata(configIdOpt), configType);
242+
} else if (configType == ConfigSchema.STANDARD_SYNC) {
243+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listStandardSyncWithMetadata(configIdOpt), configType);
244+
} else if (configType == ConfigSchema.STANDARD_SYNC_STATE) {
245+
return (ConfigWithMetadata<T>) validateAndReturn(configId, listStandardSyncStateWithMetadata(configIdOpt), configType);
246+
} else {
247+
throw new IllegalArgumentException("Unknown Config Type " + configType);
248+
}
249+
}
250+
214251
@Override
215252
public <T> List<ConfigWithMetadata<T>> listConfigsWithMetadata(final AirbyteConfig configType, final Class<T> clazz) throws IOException {
216253
final List<ConfigWithMetadata<T>> configWithMetadata = new ArrayList<>();
@@ -258,7 +295,7 @@ private List<ConfigWithMetadata<StandardWorkspace>> listStandardWorkspaceWithMet
258295
for (final Record record : result) {
259296
final List<Notification> notificationList = new ArrayList<>();
260297
final List fetchedNotifications = Jsons.deserialize(record.get(WORKSPACE.NOTIFICATIONS).data(), List.class);
261-
for (Object notification : fetchedNotifications) {
298+
for (final Object notification : fetchedNotifications) {
262299
notificationList.add(Jsons.convertValue(notification, Notification.class));
263300
}
264301
final StandardWorkspace workspace = buildStandardWorkspace(record, notificationList);

airbyte-config/persistence/src/main/java/io/airbyte/config/persistence/DeprecatedDatabaseConfigPersistence.java

+23
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,29 @@ public <T> List<T> listConfigs(final AirbyteConfig configType, final Class<T> cl
132132
.collect(Collectors.toList());
133133
}
134134

135+
@Override
136+
public <T> ConfigWithMetadata<T> getConfigWithMetadata(final AirbyteConfig configType, final String configId, final Class<T> clazz)
137+
throws ConfigNotFoundException, JsonValidationException, IOException {
138+
final Result<Record> result = database.query(ctx -> ctx.select(asterisk())
139+
.from(AIRBYTE_CONFIGS)
140+
.where(AIRBYTE_CONFIGS.CONFIG_TYPE.eq(configType.name()), AIRBYTE_CONFIGS.CONFIG_ID.eq(configId))
141+
.fetch());
142+
143+
if (result.isEmpty()) {
144+
throw new ConfigNotFoundException(configType, configId);
145+
} else if (result.size() > 1) {
146+
throw new IllegalStateException(String.format("Multiple %s configs found for ID %s: %s", configType, configId, result));
147+
}
148+
149+
final Record record = result.get(0);
150+
return new ConfigWithMetadata<>(
151+
record.get(AIRBYTE_CONFIGS.CONFIG_ID),
152+
record.get(AIRBYTE_CONFIGS.CONFIG_TYPE),
153+
record.get(AIRBYTE_CONFIGS.CREATED_AT).toInstant(),
154+
record.get(AIRBYTE_CONFIGS.UPDATED_AT).toInstant(),
155+
Jsons.deserialize(result.get(0).get(AIRBYTE_CONFIGS.CONFIG_BLOB).data(), clazz));
156+
}
157+
135158
@Override
136159
public <T> List<ConfigWithMetadata<T>> listConfigsWithMetadata(final AirbyteConfig configType, final Class<T> clazz) throws IOException {
137160
final Result<Record> results = database.query(ctx -> ctx.select(asterisk())

airbyte-config/persistence/src/main/java/io/airbyte/config/persistence/FileSystemConfigPersistence.java

+6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ public <T> List<T> listConfigs(final AirbyteConfig configType, final Class<T> cl
7979
}
8080
}
8181

82+
@Override
83+
public <T> ConfigWithMetadata<T> getConfigWithMetadata(final AirbyteConfig configType, final String configId, final Class<T> clazz)
84+
throws ConfigNotFoundException, JsonValidationException, IOException {
85+
throw new UnsupportedOperationException("File Persistence doesn't support metadata");
86+
}
87+
8288
@Override
8389
public <T> List<ConfigWithMetadata<T>> listConfigsWithMetadata(final AirbyteConfig configType, final Class<T> clazz)
8490
throws JsonValidationException, IOException {

airbyte-config/persistence/src/main/java/io/airbyte/config/persistence/ValidatingConfigPersistence.java

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ public <T> List<T> listConfigs(final AirbyteConfig configType, final Class<T> cl
4848
return configs;
4949
}
5050

51+
@Override
52+
public <T> ConfigWithMetadata<T> getConfigWithMetadata(final AirbyteConfig configType, final String configId, final Class<T> clazz)
53+
throws ConfigNotFoundException, JsonValidationException, IOException {
54+
final ConfigWithMetadata<T> config = decoratedPersistence.getConfigWithMetadata(configType, configId, clazz);
55+
validateJson(config.getConfig(), configType);
56+
return config;
57+
}
58+
5159
@Override
5260
public <T> List<ConfigWithMetadata<T>> listConfigsWithMetadata(final AirbyteConfig configType, final Class<T> clazz)
5361
throws JsonValidationException, IOException {

airbyte-config/persistence/src/test/java/io/airbyte/config/persistence/DatabaseConfigPersistenceTest.java

+15
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ public void testWriteAndGetConfig() throws Exception {
8686
.hasSameElementsAs(List.of(DESTINATION_SNOWFLAKE, DESTINATION_S3));
8787
}
8888

89+
@Test
90+
public void testGetConfigWithMetadata() throws Exception {
91+
final Instant now = Instant.now().minus(Duration.ofSeconds(1));
92+
writeDestination(configPersistence, DESTINATION_S3);
93+
final ConfigWithMetadata<StandardDestinationDefinition> configWithMetadata = configPersistence.getConfigWithMetadata(
94+
STANDARD_DESTINATION_DEFINITION,
95+
DESTINATION_S3.getDestinationDefinitionId().toString(),
96+
StandardDestinationDefinition.class);
97+
assertEquals("STANDARD_DESTINATION_DEFINITION", configWithMetadata.getConfigType());
98+
assertTrue(configWithMetadata.getCreatedAt().isAfter(now));
99+
assertTrue(configWithMetadata.getUpdatedAt().isAfter(now));
100+
assertEquals(DESTINATION_S3.getDestinationDefinitionId().toString(), configWithMetadata.getConfigId());
101+
assertEquals(DESTINATION_S3, configWithMetadata.getConfig());
102+
}
103+
89104
@Test
90105
public void testListConfigWithMetadata() throws Exception {
91106
final Instant now = Instant.now().minus(Duration.ofSeconds(1));

airbyte-config/persistence/src/test/java/io/airbyte/config/persistence/DeprecatedDatabaseConfigPersistenceTest.java

+15
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ public void testWriteAndGetConfig() throws Exception {
7878
configPersistence.listConfigs(STANDARD_DESTINATION_DEFINITION, StandardDestinationDefinition.class));
7979
}
8080

81+
@Test
82+
public void testGetConfigWithMetadata() throws Exception {
83+
final Instant now = Instant.now().minus(Duration.ofSeconds(1));
84+
writeDestination(configPersistence, DESTINATION_S3);
85+
final ConfigWithMetadata<StandardDestinationDefinition> configWithMetadata = configPersistence.getConfigWithMetadata(
86+
STANDARD_DESTINATION_DEFINITION,
87+
DESTINATION_S3.getDestinationDefinitionId().toString(),
88+
StandardDestinationDefinition.class);
89+
assertEquals("STANDARD_DESTINATION_DEFINITION", configWithMetadata.getConfigType());
90+
assertTrue(configWithMetadata.getCreatedAt().isAfter(now));
91+
assertTrue(configWithMetadata.getUpdatedAt().isAfter(now));
92+
assertEquals(DESTINATION_S3.getDestinationDefinitionId().toString(), configWithMetadata.getConfigId());
93+
assertEquals(DESTINATION_S3, configWithMetadata.getConfig());
94+
}
95+
8196
@Test
8297
public void testListConfigWithMetadata() throws Exception {
8398
final Instant now = Instant.now().minus(Duration.ofSeconds(1));

0 commit comments

Comments
 (0)