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

🎉 New SFTP source connector #13120

Merged
merged 11 commits into from
May 30, 2022
Merged

Conversation

suhomud
Copy link
Contributor

@suhomud suhomud commented May 24, 2022

What

  • Added new SFTP source connector

How

Add SFTP Connector using Java

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@suhomud
Copy link
Contributor Author

suhomud commented May 24, 2022

/test connector=connectors/source-sftp

🕑 connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2377406867
✅ connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2377406867
No Python unittests run

@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels May 24, 2022
@CLAassistant
Copy link

CLAassistant commented May 24, 2022

CLA assistant check
All committers have signed the CLA.

@suhomud suhomud changed the title Don't review 🎉 New SFTP source connector May 24, 2022
@suhomud suhomud requested a review from alexandr-shegeda May 24, 2022 12:21
@suhomud suhomud linked an issue May 24, 2022 that may be closed by this pull request
3 tasks
@grishick grishick self-requested a review May 24, 2022 23:36
@grishick
Copy link
Contributor

grishick commented May 25, 2022

@suhomud could you please sign the CLA and resolve the conflicts in docs/SUMMARY.md



@Override
public AirbyteCatalog discover(JsonNode config) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment about what the implementation of this method does?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already documented in the parent interface Source

  /**
   * Discover the current schema in the source.
   *
   * @param config - integration-specific configuration object as json. e.g. { "username": "airbyte",
   *        "password": "super secure" }
   * @return Description of the schema.
   * @throws Exception - any exception.
   */
  AirbyteCatalog discover(JsonNode config) throws Exception;

But maybe it may sense to add an extra one for Sftp implementation with more sftp discover details

@suhomud
Copy link
Contributor Author

suhomud commented May 26, 2022

@suhomud could you please sign the CLA and resolve the conflicts in docs/SUMMARY.md

Hi @grishick, I've signed CLA and looks like SUMMARY.md has been removed from master

@suhomud
Copy link
Contributor Author

suhomud commented May 26, 2022

/test connector=connectors/source-sftp

🕑 connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2389954963
✅ connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2389954963
No Python unittests run

Build Passed

Test summary info:

All Passed

Copy link
Contributor

@alexandr-shegeda alexandr-shegeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice job @suhomud
left a few minor comments

package io.airbyte.integrations.source.sftp;

import com.fasterxml.jackson.databind.JsonNode;
import com.jcraft.jsch.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, uncollapse the imports

import org.slf4j.LoggerFactory;

import java.io.ByteArrayInputStream;
import java.util.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, uncollapse the imports

/**
* Adapter from JSch's logger interface to our log4j
*/
private static class LogAdapter implements com.jcraft.jsch.Logger {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably it makes sense to move this class into a separate file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was pushed mistakenly. I have to remove it anyway

public class SftpFileParserFactory {

public static SftpFileParser createInstance(SupportedFileExtension fileExtension) {
switch (fileExtension) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we somehow re-use the existing instance of the corresponding parser? probably make it singletone?

"type": "string",
"order": 0
},
"host_address": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use host instead, to make it more generic

"required": ["user_name", "host_address", "port"],
"additionalProperties": true,
"properties": {
"user_name": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use username instead, to make it more generic

import io.airbyte.commons.resources.MoreResources;
import io.airbyte.integrations.standardtest.source.SourceAcceptanceTest;
import io.airbyte.integrations.standardtest.source.TestDestinationEnv;
import io.airbyte.protocol.models.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, uncollapse the imports

import java.io.InputStream;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, uncollapse the imports

import java.io.InputStream;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, uncollapse the imports

@suhomud
Copy link
Contributor Author

suhomud commented May 26, 2022

/test connector=connectors/source-sftp

🕑 connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2391406938
✅ connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2391406938
No Python unittests run

Build Passed

Test summary info:

All Passed

@suhomud
Copy link
Contributor Author

suhomud commented May 26, 2022

@alexandr-shegeda @grishick, I finished with updates. Could you please have a look once more?


private void checkIfConnected() {
if (!client.isConnected()) {
LOGGER.info("SFTP client is not connected.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this log message should also mention that it's about to connect. E.g. "SFTP client is not connected. Attempting to reconnect."

},
"file_type": {
"title": "File type",
"description": "The file type for data sync",
Copy link
Contributor

@grishick grishick May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this parameter allows multiple coma separated values, then the name should be "File types" and description should be "Coma separated file types. Currently only 'csv' and 'json' types are supported.".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sure. I guess we need to request multi select drop down from UI team to avoid this comma separated thing it's not user friendly

* @throws Exception - any exception.
*/
@Override
public AirbyteConnectionStatus check(JsonNode config) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see, this method actually can never throw Exception, because all code that can throw an exception is inside try-catch block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing. I'll remove it

@suhomud
Copy link
Contributor Author

suhomud commented May 27, 2022

Hi @grishick, thanks for the review! I resolved all points which you mentioned

@suhomud
Copy link
Contributor Author

suhomud commented May 27, 2022

/test connector=connectors/source-sftp

🕑 connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2394640350
✅ connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2394640350
No Python unittests run

Build Passed

Test summary info:

All Passed

@suhomud
Copy link
Contributor Author

suhomud commented May 30, 2022

/publish connector=connectors/source-sftp

🕑 connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2406649599
🚀 Successfully published connectors/source-sftp
❌ Couldn't auto-bump version for connectors/source-sftp

@suhomud
Copy link
Contributor Author

suhomud commented May 30, 2022

/publish connector=connectors/source-sftp

🕑 connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2406822167
❌ Failed to publish connectors/source-sftp
❌ Couldn't auto-bump version for connectors/source-sftp

@suhomud suhomud temporarily deployed to more-secrets May 30, 2022 04:45 Inactive
@suhomud
Copy link
Contributor Author

suhomud commented May 30, 2022

/publish connector=connectors/source-sftp

🕑 connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2407010638
🚀 Successfully published connectors/source-sftp
🚀 Auto-bumped version for connectors/source-sftp
✅ connectors/source-sftp https://github.com/airbytehq/airbyte/actions/runs/2407010638

@suhomud suhomud temporarily deployed to more-secrets May 30, 2022 05:43 Inactive
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets May 30, 2022 05:54 Inactive
@suhomud suhomud merged commit da88158 into master May 30, 2022
@suhomud suhomud deleted the suhomud/new-source-sftp-connector branch May 30, 2022 07:28
jscottpolevault pushed a commit to jscottpolevault/airbyte that referenced this pull request Jun 1, 2022
* 11797 New SFTP source
* 11797 Bump sftp source version

* auto-bump connector version

Co-authored-by: Octavia Squidington III <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Source: SFTP Connector
5 participants