-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
🎉 Destination Snowflake: Add option to stage encrypted files via S3 #12452
Conversation
/test connector=connectors/destination-snowflake
|
2b47a2b
to
9ae867b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!
...destination-s3/src/main/java/io/airbyte/integrations/destination/s3/S3StorageOperations.java
Outdated
Show resolved
Hide resolved
...t/java/io/airbyte/integrations/destination/s3/AesCbcEnvelopeEncryptionBlobDecoratorTest.java
Outdated
Show resolved
Hide resolved
...t/java/io/airbyte/integrations/destination/s3/AesCbcEnvelopeEncryptionBlobDecoratorTest.java
Outdated
Show resolved
Hide resolved
"title": "Key-encrypting key", | ||
"description": "The type of key-encrypting key to use", | ||
"type": "object", | ||
"oneOf": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should test the spec in storybook to see if it works. Previously our UI does not support multiple-level oneOf
specs very well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be replaced with a simple text field. When it is not empty, it is a user provided key. When it is empty, it is an ephemeral key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think nested oneOf work well now (tested in storybook, and also with a local airbyte instance). There's some weirdness with empty objects, but that seems like an actual bug which is also breaking e.g. the Internal Staging option - #12457
but will switch to the text field anyway, it would make the spec simpler to read + parse
airbyte-integrations/connectors/destination-snowflake/src/main/resources/spec.json
Show resolved
Hide resolved
dataStream.transferTo(outputStream); | ||
succeeded = true; | ||
} catch (final Exception e) { | ||
LOGGER.error("Failed to load data into storage {}", objectPath, e); | ||
throw new RuntimeException(e); | ||
} finally { | ||
outputStream.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if close fails, it won't execute the uploadManager cleanups
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
/test connector=connectors/destination-snowflake
|
/publish connector=connectors/destination-snowflake
|
/publish connector=connectors/destination-snowflake
|
/publish connector=connectors/destination-snowflake
|
…fix purge_staging_data (#12452)
What
We want to be able to (a) write encrypted data to S3, and (b)
COPY
those encrypted files into Snowflake.Also, fix destination-snowflake's purge_staging_data option (previously we were always deleting the output files)
How
BlobDecorator
abstract class, which represents modifications to how a single S3 (GCS, Azure Storage, etc.) file is uploaded. Implement an AesCbc subclass, which encrypts the file and sets additional metadata.BlobStorageOperations
to accept 0 or more BlobDecorators. MakeS3StorageOperations
handle those decorators correctly. (GcsStorageOperations inherits that behavior)EncryptionConfig
struct to represent different encryption strategies (currently: NoEncryption and AesCbcEnvelope)encryption
entry inside itsS3 Staging
loading method, and pass that configuration down toSnowflakeS3StagingSqlOperations
(which then injects the appropriate BlobDecorator into the S3StorageOperations, and adds the encryption key to theCOPY
command)Some additional notes:
UNLOAD
command. I did run a local sync with encryption to Snowflake (see the blob on S3 and theAIRBYTE_DATABASE.AIRBYTE_SCHEMA._airbyte_raw_edgao_customers
table in Snowflake)Recommended reading order
Deleting SnowflakeCopyS3Destination because it's no longer used anywhere.
🚨 User Impact 🚨
None. Existing configs will be use NoEncryption.
Pre-merge Checklist
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described here