Skip to content

Commit 82297a9

Browse files
🎉Redshift, Databricks, Snowflake, S3 Destinations: Make S3 output filename configurable (airbytehq#14494)
airbyte-4184: Make S3 output filename configurable
1 parent 95b3424 commit 82297a9

File tree

28 files changed

+757
-166
lines changed

28 files changed

+757
-166
lines changed

‎airbyte-config/init/src/main/resources/seed/destination_definitions.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
- name: Databricks Lakehouse
7474
destinationDefinitionId: 072d5540-f236-4294-ba7c-ade8fd918496
7575
dockerRepository: airbyte/destination-databricks
76-
dockerImageTag: 0.2.4
76+
dockerImageTag: 0.2.5
7777
documentationUrl: https://docs.airbyte.io/integrations/destinations/databricks
7878
icon: databricks.svg
7979
releaseStage: alpha
@@ -231,7 +231,7 @@
231231
- name: Redshift
232232
destinationDefinitionId: f7a7d195-377f-cf5b-70a5-be6b819019dc
233233
dockerRepository: airbyte/destination-redshift
234-
dockerImageTag: 0.3.46
234+
dockerImageTag: 0.3.47
235235
documentationUrl: https://docs.airbyte.io/integrations/destinations/redshift
236236
icon: redshift.svg
237237
resourceRequirements:
@@ -250,7 +250,7 @@
250250
- name: S3
251251
destinationDefinitionId: 4816b78f-1489-44c1-9060-4b19d5fa9362
252252
dockerRepository: airbyte/destination-s3
253-
dockerImageTag: 0.3.10
253+
dockerImageTag: 0.3.11
254254
documentationUrl: https://docs.airbyte.io/integrations/destinations/s3
255255
icon: s3.svg
256256
resourceRequirements:
@@ -270,7 +270,7 @@
270270
- name: Snowflake
271271
destinationDefinitionId: 424892c4-daac-4491-b35d-c6688ba547ba
272272
dockerRepository: airbyte/destination-snowflake
273-
dockerImageTag: 0.4.32
273+
dockerImageTag: 0.4.33
274274
documentationUrl: https://docs.airbyte.io/integrations/destinations/snowflake
275275
icon: snowflake.svg
276276
resourceRequirements:

‎airbyte-config/init/src/main/resources/seed/destination_specs.yaml

+52-4
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@
966966
- "overwrite"
967967
- "append"
968968
- "append_dedup"
969-
- dockerImage: "airbyte/destination-databricks:0.2.4"
969+
- dockerImage: "airbyte/destination-databricks:0.2.5"
970970
spec:
971971
documentationUrl: "https://docs.airbyte.io/integrations/destinations/databricks"
972972
connectionSpecification:
@@ -1116,6 +1116,18 @@
11161116
- "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY"
11171117
airbyte_secret: true
11181118
order: 6
1119+
file_name_pattern:
1120+
type: "string"
1121+
description: "The pattern allows you to set the file-name format for\
1122+
\ the S3 staging file(s)"
1123+
title: "S3 Filename pattern (Optional)"
1124+
examples:
1125+
- "{date}"
1126+
- "{date:yyyy_MM}"
1127+
- "{timestamp}"
1128+
- "{part_number}"
1129+
- "{sync_id}"
1130+
order: 7
11191131
order: 7
11201132
purge_staging_data:
11211133
title: "Purge Staging Files and Tables"
@@ -3708,7 +3720,7 @@
37083720
supported_destination_sync_modes:
37093721
- "overwrite"
37103722
- "append"
3711-
- dockerImage: "airbyte/destination-redshift:0.3.46"
3723+
- dockerImage: "airbyte/destination-redshift:0.3.47"
37123724
spec:
37133725
documentationUrl: "https://docs.airbyte.io/integrations/destinations/redshift"
37143726
connectionSpecification:
@@ -3833,6 +3845,18 @@
38333845
- "eu-west-3"
38343846
- "sa-east-1"
38353847
- "me-south-1"
3848+
file_name_pattern:
3849+
type: "string"
3850+
description: "The pattern allows you to set the file-name format for\
3851+
\ the S3 staging file(s)"
3852+
title: "S3 Filename pattern (Optional)"
3853+
examples:
3854+
- "{date}"
3855+
- "{date:yyyy_MM}"
3856+
- "{timestamp}"
3857+
- "{part_number}"
3858+
- "{sync_id}"
3859+
order: 8
38363860
access_key_id:
38373861
type: "string"
38383862
description: "This ID grants access to the above S3 staging bucket.\
@@ -3946,7 +3970,7 @@
39463970
supported_destination_sync_modes:
39473971
- "append"
39483972
- "overwrite"
3949-
- dockerImage: "airbyte/destination-s3:0.3.10"
3973+
- dockerImage: "airbyte/destination-s3:0.3.11"
39503974
spec:
39513975
documentationUrl: "https://docs.airbyte.io/integrations/destinations/s3"
39523976
connectionSpecification:
@@ -4305,6 +4329,18 @@
43054329
examples:
43064330
- "${NAMESPACE}/${STREAM_NAME}/${YEAR}_${MONTH}_${DAY}_${EPOCH}_"
43074331
order: 7
4332+
file_name_pattern:
4333+
type: "string"
4334+
description: "The pattern allows you to set the file-name format for the\
4335+
\ S3 staging file(s)"
4336+
title: "S3 Filename pattern (Optional)"
4337+
examples:
4338+
- "{date}"
4339+
- "{date:yyyy_MM}"
4340+
- "{timestamp}"
4341+
- "{part_number}"
4342+
- "{sync_id}"
4343+
order: 8
43084344
supportsIncremental: true
43094345
supportsNormalization: false
43104346
supportsDBT: false
@@ -4364,7 +4400,7 @@
43644400
supported_destination_sync_modes:
43654401
- "overwrite"
43664402
- "append"
4367-
- dockerImage: "airbyte/destination-snowflake:0.4.32"
4403+
- dockerImage: "airbyte/destination-snowflake:0.4.33"
43684404
spec:
43694405
documentationUrl: "https://docs.airbyte.io/integrations/destinations/snowflake"
43704406
connectionSpecification:
@@ -4635,6 +4671,18 @@
46354671
\ or 256 bits. Leave blank to have Airbyte generate an ephemeral\
46364672
\ key for each sync."
46374673
airbyte_secret: true
4674+
file_name_pattern:
4675+
type: "string"
4676+
description: "The pattern allows you to set the file-name format for\
4677+
\ the S3 staging file(s)"
4678+
title: "S3 Filename pattern (Optional)"
4679+
examples:
4680+
- "{date}"
4681+
- "{date:yyyy_MM}"
4682+
- "{timestamp}"
4683+
- "{part_number}"
4684+
- "{sync_id}"
4685+
order: 7
46384686
- title: "Google Cloud Storage Staging"
46394687
description: "Recommended for large production workloads for better speed\
46404688
\ and scalability."

‎airbyte-integrations/connectors/destination-databricks/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION destination-databricks
1616

1717
COPY --from=build /airbyte /airbyte
1818

19-
LABEL io.airbyte.version=0.2.4
19+
LABEL io.airbyte.version=0.2.5
2020
LABEL io.airbyte.name=airbyte/destination-databricks

‎airbyte-integrations/connectors/destination-databricks/src/main/java/io/airbyte/integrations/destination/databricks/DatabricksDestinationConfig.java

+12-8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.fasterxml.jackson.databind.ObjectMapper;
99
import com.google.common.base.Preconditions;
1010
import io.airbyte.integrations.destination.s3.S3DestinationConfig;
11+
import io.airbyte.integrations.destination.s3.constant.S3Constants;
1112
import io.airbyte.integrations.destination.s3.parquet.S3ParquetFormatConfig;
1213

1314
/**
@@ -59,15 +60,18 @@ public static DatabricksDestinationConfig get(final JsonNode config) {
5960
}
6061

6162
public static S3DestinationConfig getDataSource(final JsonNode dataSource) {
62-
return S3DestinationConfig.create(
63-
dataSource.get("s3_bucket_name").asText(),
64-
dataSource.get("s3_bucket_path").asText(),
65-
dataSource.get("s3_bucket_region").asText())
63+
final S3DestinationConfig.Builder builder = S3DestinationConfig.create(
64+
dataSource.get(S3Constants.S_3_BUCKET_NAME).asText(),
65+
dataSource.get(S3Constants.S_3_BUCKET_PATH).asText(),
66+
dataSource.get(S3Constants.S_3_BUCKET_REGION).asText())
6667
.withAccessKeyCredential(
67-
dataSource.get("s3_access_key_id").asText(),
68-
dataSource.get("s3_secret_access_key").asText())
69-
.withFormatConfig(new S3ParquetFormatConfig(new ObjectMapper().createObjectNode()))
70-
.get();
68+
dataSource.get(S3Constants.S_3_ACCESS_KEY_ID).asText(),
69+
dataSource.get(S3Constants.S_3_SECRET_ACCESS_KEY).asText())
70+
.withFormatConfig(new S3ParquetFormatConfig(new ObjectMapper().createObjectNode()));
71+
if (dataSource.has(S3Constants.FILE_NAME_PATTERN)) {
72+
builder.withFileNamePattern(dataSource.get(S3Constants.FILE_NAME_PATTERN).asText());
73+
}
74+
return builder.get();
7175
}
7276

7377
public String getDatabricksServerHostname() {

‎airbyte-integrations/connectors/destination-databricks/src/main/java/io/airbyte/integrations/destination/databricks/DatabricksStreamCopier.java

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
package io.airbyte.integrations.destination.databricks;
66

7+
import static org.apache.logging.log4j.util.Strings.EMPTY;
8+
79
import com.amazonaws.services.s3.AmazonS3;
810
import com.fasterxml.jackson.databind.ObjectMapper;
911
import io.airbyte.db.jdbc.JdbcDatabase;
@@ -18,6 +20,7 @@
1820
import io.airbyte.protocol.models.ConfiguredAirbyteStream;
1921
import io.airbyte.protocol.models.DestinationSyncMode;
2022
import java.sql.Timestamp;
23+
import java.util.Optional;
2124
import java.util.UUID;
2225
import org.slf4j.Logger;
2326
import org.slf4j.LoggerFactory;
@@ -209,6 +212,7 @@ static S3DestinationConfig getStagingS3DestinationConfig(final S3DestinationConf
209212
return S3DestinationConfig.create(config)
210213
.withBucketPath(String.join("/", config.getBucketPath(), stagingFolder))
211214
.withFormatConfig(new S3ParquetFormatConfig(MAPPER.createObjectNode()))
215+
.withFileNamePattern(Optional.ofNullable(config.getFileNamePattern()).orElse(EMPTY))
212216
.get();
213217
}
214218

‎airbyte-integrations/connectors/destination-databricks/src/main/resources/spec.json

+9
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@
147147
"examples": ["a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY"],
148148
"airbyte_secret": true,
149149
"order": 6
150+
},
151+
"file_name_pattern": {
152+
"type": "string",
153+
"description": "The pattern allows you to set the file-name format for the S3 staging file(s)",
154+
"title": "S3 Filename pattern (Optional)",
155+
"examples": [
156+
"{date}", "{date:yyyy_MM}", "{timestamp}", "{part_number}", "{sync_id}"
157+
],
158+
"order": 7
150159
}
151160
}
152161
}

‎airbyte-integrations/connectors/destination-redshift/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION destination-redshift
1616

1717
COPY --from=build /airbyte /airbyte
1818

19-
LABEL io.airbyte.version=0.3.46
19+
LABEL io.airbyte.version=0.3.47
2020
LABEL io.airbyte.name=airbyte/destination-redshift

‎airbyte-integrations/connectors/destination-redshift/src/main/resources/spec.json

+9
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@
121121
"me-south-1"
122122
]
123123
},
124+
"file_name_pattern": {
125+
"type": "string",
126+
"description": "The pattern allows you to set the file-name format for the S3 staging file(s)",
127+
"title": "S3 Filename pattern (Optional)",
128+
"examples": [
129+
"{date}", "{date:yyyy_MM}", "{timestamp}", "{part_number}", "{sync_id}"
130+
],
131+
"order": 8
132+
},
124133
"access_key_id": {
125134
"type": "string",
126135
"description": "This ID grants access to the above S3 staging bucket. Airbyte requires Read and Write permissions to the given bucket. See <a href=\"https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys\">AWS docs</a> on how to generate an access key ID and secret access key.",

‎airbyte-integrations/connectors/destination-s3/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION destination-s3
1616

1717
COPY --from=build /airbyte /airbyte
1818

19-
LABEL io.airbyte.version=0.3.10
19+
LABEL io.airbyte.version=0.3.11
2020
LABEL io.airbyte.name=airbyte/destination-s3

0 commit comments

Comments
 (0)