Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎉Redshift, Databricks, Snowflake, S3 Destinations: Make S3 output filename configurable #14494

Merged
merged 19 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
59a1114
airbyte-4184: Make S3 output filename configurable
alexandertsukanov Jul 7, 2022
f6624b4
airbyte-4184: Make S3 output filename configurable
alexandertsukanov Jul 7, 2022
844779c
airbyte-4184: Make S3 output filename configurable
alexandertsukanov Jul 7, 2022
87a196e
Merge branch 'master' into otsukanov/airbyte-4184_configurable_filename
alexandertsukanov Jul 11, 2022
b4b4b0c
airbyte-4184: Run reformat.
alexandertsukanov Jul 11, 2022
f74acc7
airbyte-4184 Fixed PR comments.
alexandertsukanov Jul 14, 2022
8ccb71e
Merge branch 'master' into otsukanov/airbyte-4184_configurable_filename
alexandertsukanov Jul 14, 2022
50c3a38
airbyte-4184 Fix pr comments.
alexandertsukanov Jul 14, 2022
6f1db72
airbyte-4148: Fixed PR comments.
alexandertsukanov Jul 14, 2022
51939cc
Merge branch 'master' into otsukanov/airbyte-4184_configurable_filename
alexandertsukanov Jul 15, 2022
f6f3768
airbyte-4148: Fixed PR comments.
alexandertsukanov Jul 15, 2022
7030070
airbyte-4148: Fixed PR comments.
alexandertsukanov Jul 15, 2022
c9ae1f6
airbyte-4148: Bump versions.
alexandertsukanov Jul 15, 2022
ccf53f9
Merge branch 'master' into otsukanov/airbyte-4184_configurable_filename
alexandertsukanov Jul 15, 2022
ea027b3
airbyte-4148: Bump versions.
alexandertsukanov Jul 15, 2022
7882ead
auto-bump connector version
octavia-squidington-iii Jul 15, 2022
8d45f9f
auto-bump connector version
octavia-squidington-iii Jul 15, 2022
5d202aa
auto-bump connector version
octavia-squidington-iii Jul 15, 2022
1e60667
auto-bump connector version
octavia-squidington-iii Jul 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
- name: Databricks Lakehouse
destinationDefinitionId: 072d5540-f236-4294-ba7c-ade8fd918496
dockerRepository: airbyte/destination-databricks
dockerImageTag: 0.2.4
dockerImageTag: 0.2.5
documentationUrl: https://docs.airbyte.io/integrations/destinations/databricks
icon: databricks.svg
releaseStage: alpha
Expand Down Expand Up @@ -231,7 +231,7 @@
- name: Redshift
destinationDefinitionId: f7a7d195-377f-cf5b-70a5-be6b819019dc
dockerRepository: airbyte/destination-redshift
dockerImageTag: 0.3.46
dockerImageTag: 0.3.47
documentationUrl: https://docs.airbyte.io/integrations/destinations/redshift
icon: redshift.svg
resourceRequirements:
Expand All @@ -250,7 +250,7 @@
- name: S3
destinationDefinitionId: 4816b78f-1489-44c1-9060-4b19d5fa9362
dockerRepository: airbyte/destination-s3
dockerImageTag: 0.3.10
dockerImageTag: 0.3.11
documentationUrl: https://docs.airbyte.io/integrations/destinations/s3
icon: s3.svg
resourceRequirements:
Expand All @@ -270,7 +270,7 @@
- name: Snowflake
destinationDefinitionId: 424892c4-daac-4491-b35d-c6688ba547ba
dockerRepository: airbyte/destination-snowflake
dockerImageTag: 0.4.32
dockerImageTag: 0.4.33
documentationUrl: https://docs.airbyte.io/integrations/destinations/snowflake
icon: snowflake.svg
resourceRequirements:
Expand Down
56 changes: 52 additions & 4 deletions airbyte-config/init/src/main/resources/seed/destination_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@
- "overwrite"
- "append"
- "append_dedup"
- dockerImage: "airbyte/destination-databricks:0.2.4"
- dockerImage: "airbyte/destination-databricks:0.2.5"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/destinations/databricks"
connectionSpecification:
Expand Down Expand Up @@ -1116,6 +1116,18 @@
- "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY"
airbyte_secret: true
order: 6
file_name_pattern:
type: "string"
description: "The pattern allows you to set the file-name format for\
\ the S3 staging file(s)"
title: "S3 Filename pattern (Optional)"
examples:
- "{date}"
- "{date:yyyy_MM}"
- "{timestamp}"
- "{part_number}"
- "{sync_id}"
order: 7
order: 7
purge_staging_data:
title: "Purge Staging Files and Tables"
Expand Down Expand Up @@ -3708,7 +3720,7 @@
supported_destination_sync_modes:
- "overwrite"
- "append"
- dockerImage: "airbyte/destination-redshift:0.3.46"
- dockerImage: "airbyte/destination-redshift:0.3.47"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/destinations/redshift"
connectionSpecification:
Expand Down Expand Up @@ -3833,6 +3845,18 @@
- "eu-west-3"
- "sa-east-1"
- "me-south-1"
file_name_pattern:
type: "string"
description: "The pattern allows you to set the file-name format for\
\ the S3 staging file(s)"
title: "S3 Filename pattern (Optional)"
examples:
- "{date}"
- "{date:yyyy_MM}"
- "{timestamp}"
- "{part_number}"
- "{sync_id}"
order: 8
access_key_id:
type: "string"
description: "This ID grants access to the above S3 staging bucket.\
Expand Down Expand Up @@ -3946,7 +3970,7 @@
supported_destination_sync_modes:
- "append"
- "overwrite"
- dockerImage: "airbyte/destination-s3:0.3.10"
- dockerImage: "airbyte/destination-s3:0.3.11"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/destinations/s3"
connectionSpecification:
Expand Down Expand Up @@ -4305,6 +4329,18 @@
examples:
- "${NAMESPACE}/${STREAM_NAME}/${YEAR}_${MONTH}_${DAY}_${EPOCH}_"
order: 7
file_name_pattern:
type: "string"
description: "The pattern allows you to set the file-name format for the\
\ S3 staging file(s)"
title: "S3 Filename pattern (Optional)"
examples:
- "{date}"
- "{date:yyyy_MM}"
- "{timestamp}"
- "{part_number}"
- "{sync_id}"
order: 8
supportsIncremental: true
supportsNormalization: false
supportsDBT: false
Expand Down Expand Up @@ -4364,7 +4400,7 @@
supported_destination_sync_modes:
- "overwrite"
- "append"
- dockerImage: "airbyte/destination-snowflake:0.4.32"
- dockerImage: "airbyte/destination-snowflake:0.4.33"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/destinations/snowflake"
connectionSpecification:
Expand Down Expand Up @@ -4635,6 +4671,18 @@
\ or 256 bits. Leave blank to have Airbyte generate an ephemeral\
\ key for each sync."
airbyte_secret: true
file_name_pattern:
type: "string"
description: "The pattern allows you to set the file-name format for\
\ the S3 staging file(s)"
title: "S3 Filename pattern (Optional)"
examples:
- "{date}"
- "{date:yyyy_MM}"
- "{timestamp}"
- "{part_number}"
- "{sync_id}"
order: 7
- title: "Google Cloud Storage Staging"
description: "Recommended for large production workloads for better speed\
\ and scalability."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION destination-databricks

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=0.2.4
LABEL io.airbyte.version=0.2.5
LABEL io.airbyte.name=airbyte/destination-databricks
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Preconditions;
import io.airbyte.integrations.destination.s3.S3DestinationConfig;
import io.airbyte.integrations.destination.s3.constant.S3Constants;
import io.airbyte.integrations.destination.s3.parquet.S3ParquetFormatConfig;

/**
Expand Down Expand Up @@ -59,15 +60,18 @@ public static DatabricksDestinationConfig get(final JsonNode config) {
}

public static S3DestinationConfig getDataSource(final JsonNode dataSource) {
return S3DestinationConfig.create(
dataSource.get("s3_bucket_name").asText(),
dataSource.get("s3_bucket_path").asText(),
dataSource.get("s3_bucket_region").asText())
final S3DestinationConfig.Builder builder = S3DestinationConfig.create(
dataSource.get(S3Constants.S_3_BUCKET_NAME).asText(),
dataSource.get(S3Constants.S_3_BUCKET_PATH).asText(),
dataSource.get(S3Constants.S_3_BUCKET_REGION).asText())
.withAccessKeyCredential(
dataSource.get("s3_access_key_id").asText(),
dataSource.get("s3_secret_access_key").asText())
.withFormatConfig(new S3ParquetFormatConfig(new ObjectMapper().createObjectNode()))
.get();
dataSource.get(S3Constants.S_3_ACCESS_KEY_ID).asText(),
dataSource.get(S3Constants.S_3_SECRET_ACCESS_KEY).asText())
.withFormatConfig(new S3ParquetFormatConfig(new ObjectMapper().createObjectNode()));
if (dataSource.has(S3Constants.FILE_NAME_PATTERN)) {
builder.withFileNamePattern(dataSource.get(S3Constants.FILE_NAME_PATTERN).asText());
}
return builder.get();
}

public String getDatabricksServerHostname() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package io.airbyte.integrations.destination.databricks;

import static org.apache.logging.log4j.util.Strings.EMPTY;

import com.amazonaws.services.s3.AmazonS3;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.airbyte.db.jdbc.JdbcDatabase;
Expand All @@ -18,6 +20,7 @@
import io.airbyte.protocol.models.ConfiguredAirbyteStream;
import io.airbyte.protocol.models.DestinationSyncMode;
import java.sql.Timestamp;
import java.util.Optional;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -209,6 +212,7 @@ static S3DestinationConfig getStagingS3DestinationConfig(final S3DestinationConf
return S3DestinationConfig.create(config)
.withBucketPath(String.join("/", config.getBucketPath(), stagingFolder))
.withFormatConfig(new S3ParquetFormatConfig(MAPPER.createObjectNode()))
.withFileNamePattern(Optional.ofNullable(config.getFileNamePattern()).orElse(EMPTY))
.get();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@
"examples": ["a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY"],
"airbyte_secret": true,
"order": 6
},
"file_name_pattern": {
"type": "string",
"description": "The pattern allows you to set the file-name format for the S3 staging file(s)",
"title": "S3 Filename pattern (Optional)",
"examples": [
"{date}", "{date:yyyy_MM}", "{timestamp}", "{part_number}", "{sync_id}"
],
"order": 7
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION destination-redshift

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=0.3.46
LABEL io.airbyte.version=0.3.47
LABEL io.airbyte.name=airbyte/destination-redshift
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@
"me-south-1"
]
},
"file_name_pattern": {
"type": "string",
"description": "The pattern allows you to set the file-name format for the S3 staging file(s)",
"title": "S3 Filename pattern (Optional)",
"examples": [
"{date}", "{date:yyyy_MM}", "{timestamp}", "{part_number}", "{sync_id}"
],
"order": 8
},
"access_key_id": {
"type": "string",
"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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION destination-s3

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=0.3.10
LABEL io.airbyte.version=0.3.11
LABEL io.airbyte.name=airbyte/destination-s3
Loading