-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
MS SQL Server Destination implementation #3195
Conversation
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.
LGTM but requesting changes to confirm we're not forgetting a required param
...tination-mssql/src/main/java/io/airbyte/integrations/destination/mssql/MSSQLDestination.java
Outdated
Show resolved
Hide resolved
...tination-mssql/src/main/java/io/airbyte/integrations/destination/mssql/MSSQLDestination.java
Outdated
Show resolved
Hide resolved
config.get("username").asText(), | ||
config.get("password").asText())); | ||
|
||
if (config.has("ssl") && config.get("ssl").asBoolean()) { |
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.
ssl on v1, nice!
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.
the SSL stuff is great. I think we need at least one test to check it. There are 2 options here:
- just right a one off unit test that runs check connection with SSL turned on and sanity check that it works.
- add a test in TestDestination that only runs if the destination is configurable with SSL. it would similarly probably just run check connection.
i don't have a really strong preference either way. 1 is probably easier 🤷♀️
...ation-mssql/src/main/java/io/airbyte/integrations/destination/mssql/SqlServerOperations.java
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/destination-mssql/src/main/resources/spec.json
Outdated
Show resolved
Hide resolved
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 was very curious about the implementation of a target, so I was super 🕵️ leave some comments in general LGTM
...tination-mssql/src/main/java/io/airbyte/integrations/destination/mssql/MSSQLDestination.java
Outdated
Show resolved
Hide resolved
...tination-mssql/src/main/java/io/airbyte/integrations/destination/mssql/MSSQLDestination.java
Outdated
Show resolved
Hide resolved
...tination-mssql/src/main/java/io/airbyte/integrations/destination/mssql/MSSQLDestination.java
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/destination-mssql/src/main/resources/spec.json
Outdated
Show resolved
Hide resolved
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.
one question about why database is being removed from the implementation. after that's resolved i think this is good to go! nice work.
...tination-mssql/src/main/java/io/airbyte/integrations/destination/mssql/MSSQLDestination.java
Outdated
Show resolved
Hide resolved
...ation-mssql/src/main/java/io/airbyte/integrations/destination/mssql/SqlServerOperations.java
Outdated
Show resolved
Hide resolved
...rc/test-integration/java/io/airbyte/integrations/destination/mssql/MSSQLIntegrationTest.java
Outdated
Show resolved
Hide resolved
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 believe we're using params not declared in spec.json so double checking on this.
additionalParameters.add("ssl=true"); | ||
additionalParameters.add("sslmode=require"); | ||
additionalParameters.add("encrypt=true"); | ||
if (config.has("trustServerCertificate") && config.get("trustServerCertificate").asBoolean()) { |
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.
where would these params come from? I don't see this in spec.json
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 has been added to spec.json
airbyte-integrations/connectors/destination-mssql/src/main/resources/spec.json
Outdated
Show resolved
Hide resolved
additionalParameters.add("trustServerCertificate=true"); | ||
} else { | ||
additionalParameters.add("trustServerCertificate=false"); | ||
additionalParameters.add("trustStore=" + config.get("trustStoreName").asText()); |
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 is not declared in spec.json
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 has now been added to spec.json.
...ion-test/src/main/java/io/airbyte/integrations/standardtest/destination/TestDestination.java
Outdated
Show resolved
Hide resolved
/test connector=destination-mssql
|
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.
nice! a few more comments (each is described in more detail in line):
- SSL needs to be in the spec.
- SSL needs a test
- we shouldn't need to implement
getDatabase
airbyte-integrations/connectors/destination-mssql/src/main/resources/spec.json
Outdated
Show resolved
Hide resolved
if (config.has("trustServerCertificate") && config.get("trustServerCertificate").asBoolean()) { | ||
additionalParameters.add("trustServerCertificate=true"); | ||
} else { | ||
additionalParameters.add("trustServerCertificate=false"); |
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.
how is this getting set? it seems like you want to add some fields for users to optionally configure. if so you need to add them in the spec.json
. ping me if the relationship between the 2 isn't clear and i can walk through it!
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 has now been added to spec.json.
...tination-mssql/src/main/java/io/airbyte/integrations/destination/mssql/MSSQLDestination.java
Outdated
Show resolved
Hide resolved
config.get("username").asText(), | ||
config.get("password").asText())); | ||
|
||
if (config.has("ssl") && config.get("ssl").asBoolean()) { |
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.
the SSL stuff is great. I think we need at least one test to check it. There are 2 options here:
- just right a one off unit test that runs check connection with SSL turned on and sanity check that it works.
- add a test in TestDestination that only runs if the destination is configurable with SSL. it would similarly probably just run check connection.
i don't have a really strong preference either way. 1 is probably easier 🤷♀️
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.
Great! 3 other things you need to do in order to get this ready (other than what is mentioned in the comments below:
- Please make sure you add a documentation page. You can use the postgres one as an example.
- Add this destination to https://github.com/airbytehq/airbyte/blob/master/airbyte-config/init/src/main/resources/seed/destination_definitions.yaml so that this new destination will appear in the UI by default.
- Actually run a sync in the UI manually with this destination to sanity check that the E2E experience is good!
...rc/test-integration/java/io/airbyte/integrations/destination/mssql/MSSQLIntegrationTest.java
Outdated
Show resolved
Hide resolved
import org.testcontainers.containers.MSSQLServerContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
public class MSSQLIntegrationTestSSL extends TestDestination { |
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.
can you create an issue that we should figure out a way to consolidate SSL tests for destinations, so that we don't have top copy and paste test classes like this. definitely don't think we need to worry about doing this right now, but i want us to keep track of it.
"ssl": { | ||
"title": "SSL Connection", | ||
"description": "Encrypt data using SSL.", | ||
"type": "boolean", | ||
"default": false, | ||
"order": 6 | ||
}, | ||
"trustServerCertificate": { | ||
"title": "Trust Server Certificate", | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Whether or not to implicitly trust the server certificate without verification. (Useful for local test databases.)", | ||
"examples": [true, false], | ||
"order": 7 | ||
}, | ||
"trustStoreName": { | ||
"title": "Trust Store Name", | ||
"type": "string", | ||
"description": "The full path (including filename) to the certificate trustStore file, which contains the list of certificates that the client trusts.", | ||
"order": 8 | ||
}, | ||
"trustStorePassword": { | ||
"title": "Trust Store Password", | ||
"type": "string", | ||
"description": "The password used to check the integrity of the trustStore data.", | ||
"order": 9 | ||
}, | ||
"hostNameInCertificate": { | ||
"title": "Host Name In Certificate", | ||
"type": "string", | ||
"description": "Specifies the host name of the server. The value of this property must match the subject property of the certificate.", | ||
"order": 10 | ||
} | ||
} | ||
} |
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 seems like it should be a oneOf
for clarity. I would suggest replacing this configuration with something that looks like this:
"ssl_method": {
"title": "SSL Method",
"type": "object",
"description": "Encryption method to use when communicating with the database",
"order": 6,
"oneOf": [
{
"title": "Unencrypted",
"additionalProperties": false,
"description": "Data transfer will not be encrypted.",
"required": ["ssl_method"],
"properties": {
"ssl_method": {
"type": "string",
"enum": ["unencrypted"],
"default": "unencrypted"
}
}
},
{
"title": "Encrypted (trust server certificate)",
"additionalProperties": false,
"description": "Use the cert provided by the server.",
"required": ["ssl_method"],
"properties": {
"ssl_method": {
"type": "string",
"enum": ["encrypted_trust_server_certificate"],
"default": "encrypted_trust_server_certificate"
}
}
},
{
"title": "Encrypted (verify certificate)",
"additionalProperties": false,
"description": "Data transfer will not be encrypted.",
"required": ["ssl_method", "trustStoreName", "trustStorePassword"],
"properties": {
"ssl_method": {
"type": "string",
"enum": ["encrypted_verify_certificate"],
"default": "encrypted_verify_certificate"
},
"trustStoreName": {
"title": "Trust Store Name",
"type": "string",
"description": "The full path (including filename) to the certificate trustStore file, which contains the list of certificates that the client trusts.",
"order": 8
},
"trustStorePassword": {
"title": "Trust Store Password",
"type": "string",
"description": "The password used to check the integrity of the trustStore data.",
"order": 9
},
"hostNameInCertificate": {
"title": "Host Name In Certificate",
"type": "string",
"description": "Specifies the host name of the server. The value of this property must match the subject property of the certificate.",
"order": 10
}
}
}
]
}
This displays in the UI as follows:
What do you think? If you adopt this configuration, you'll have to adjust how the config is parsed in the MSSQLDestination
and the config that gets passed in the test suites.
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.
LGTM with requested changes from charles
Co-authored-by: Charles <giardina.charles@gmail.com>
Adding the destination to the list Reworking SSL configuration to move internal information out of config
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.
Looks good. I think you're ready to ship it.
To deploy this you need to add this command as a comment in this PR:
/publish connector=connectors/source-mssql
You can see an example of this here. That will publish your docker container to docker hub. Once that succeeds, re-run the build in the PR. That should get you past the current build failure (which is just checking that the connector is published).
/publish connector=connectors/destination-mssql
|
After addressing the requested changes, GitHub is glitching, saying there are changes to address. Dismissing the review to get it to go away.
No description provided.