Skip to content

Destination Snowflake Execute COPY in parallel - #10212

Merged
VitaliiMaltsev merged 62 commits into
masterfrom
vmaltsev/9087-destination-snowflake-parralel-copy
Feb 17, 2022
Merged

VitaliiMaltsev merged 62 commits into
masterfrom
vmaltsev/9087-destination-snowflake-parralel-copy

Conversation

@VitaliiMaltsev

@VitaliiMaltsev VitaliiMaltsev commented Feb 9, 2022 •

Copy link
Copy Markdown
Contributor

What

Currently, destination-snowflake's copy modes will generate multiple files on S3 or GCS, and then for each of those files, execute a COPY command in serial. We should run those commands in parallel to be more time-efficient.

How

COPY command can accept up to 1,000 files.

Recommended reading order

  1. SnowflakeParallelCopyStreamCopier.java
  2. SnowflakeS3StreamCopier.java
  3. SnowflakeGCSStreamCopier.java

🚨 User Impact 🚨

there should not be visible user impact

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
  • Credentials added to Github CI. 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

Updating a connector

Community member or Airbyter

  • 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
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • 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
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the new connector version is published, connector version bumped in the seed directory 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

Connector Generator

  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed.

vmaltsev added 30 commits December 15, 2021 10:45
@VitaliiMaltsev

VitaliiMaltsev commented Feb 16, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-snowflake

🕑 connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1854607052
✅ connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1854607052
Python tests coverage:

Name                                                                                                                            Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------------------------------------------------
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/__init__.py                      2      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/__init__.py               1      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/airbyte_protocol.py     124      0   100%
normalization/__init__.py                                                                                                           4      0   100%
normalization/destination_type.py                                                                                                  13      0   100%
normalization/transform_catalog/__init__.py                                                                                         2      0   100%
normalization/transform_catalog/catalog_processor.py                                                                              143     77    46%
normalization/transform_catalog/destination_name_transformer.py                                                                   155      8    95%
normalization/transform_catalog/reserved_keywords.py                                                                               13      0   100%
normalization/transform_catalog/stream_processor.py                                                                               520    333    36%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/transform.py                                                                                       45     26    42%
normalization/transform_catalog/utils.py                                                                                           33      7    79%
normalization/transform_config/__init__.py                                                                                          2      0   100%
normalization/transform_config/transform.py                                                                                       148     34    77%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1379    519    62%

@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 16, 2022 18:42 Inactive
@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 16, 2022 18:42 Inactive
@octavia-squidington-iii
Octavia Squidington III (octavia-squidington-iii) temporarily deployed to more-secrets February 16, 2022 18:44 Inactive

@edgao Edward Gao (edgao) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

two final comments, but otherwise this lgtm!

import java.util.concurrent.ExecutorService;
import java.util.stream.IntStream;

interface SnowflakeParallelCopyStreamCopier {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you add javadoc comments to the methods in this interface?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

can you add javadoc comments to the methods in this interface?

done

@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 17, 2022 09:05 Inactive
@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 17, 2022 09:05 Inactive
@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 17, 2022 09:31 Inactive
@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 17, 2022 09:31 Inactive
@VitaliiMaltsev

VitaliiMaltsev commented Feb 17, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-snowflake

🕑 connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1857825513
✅ connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1857825513
Python tests coverage:

Name                                                                                                                            Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------------------------------------------------
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/__init__.py                      2      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/__init__.py               1      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/airbyte_protocol.py     124      0   100%
normalization/__init__.py                                                                                                           4      0   100%
normalization/destination_type.py                                                                                                  13      0   100%
normalization/transform_catalog/__init__.py                                                                                         2      0   100%
normalization/transform_catalog/catalog_processor.py                                                                              143     77    46%
normalization/transform_catalog/destination_name_transformer.py                                                                   155      8    95%
normalization/transform_catalog/reserved_keywords.py                                                                               13      0   100%
normalization/transform_catalog/stream_processor.py                                                                               520    333    36%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/transform.py                                                                                       45     26    42%
normalization/transform_catalog/utils.py                                                                                           33      7    79%
normalization/transform_config/__init__.py                                                                                          2      0   100%
normalization/transform_config/transform.py                                                                                       148     34    77%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1379    519    62%

@VitaliiMaltsev

VitaliiMaltsev commented Feb 17, 2022 •

Copy link
Copy Markdown
Contributor Author

/publish connector=connectors/destination-snowflake

🕑 connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1860132032
❌ connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1860132032

@octavia-squidington-iii
Octavia Squidington III (octavia-squidington-iii) temporarily deployed to more-secrets February 17, 2022 17:35 Inactive
@VitaliiMaltsev

VitaliiMaltsev commented Feb 17, 2022 •

Copy link
Copy Markdown
Contributor Author

/publish connector=connectors/destination-snowflake

🕑 connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1860192267
✅ connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1860192267

@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 17, 2022 17:47 Inactive
@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 17, 2022 17:47 Inactive
@octavia-squidington-iii
Octavia Squidington III (octavia-squidington-iii) temporarily deployed to more-secrets February 17, 2022 17:48 Inactive
@VitaliiMaltsev
VitaliiMaltsev merged commit c9bd5e9 into master Feb 17, 2022
@VitaliiMaltsev
VitaliiMaltsev deleted the vmaltsev/9087-destination-snowflake-parralel-copy branch February 17, 2022 19:16
@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 17, 2022 19:17 Inactive
@VitaliiMaltsev
VitaliiMaltsev temporarily deployed to more-secrets February 17, 2022 19:17 Inactive

This branch was previously deployed

1 inactive deployment
more-secrets — fb3d9b40 Deployed Feb 17, 2022 by VitaliiMaltsev
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.

Snowflake copy destinations should execute COPY commands in parallel

7 participants