Skip to content

🐛Destination-bigquery: added additional verifications to Check method - #18554

Merged
Eugene (etsybaev) merged 16 commits into
masterfrom
etsybaev/16992-dest-bigquery-fix-check-verification
Nov 10, 2022
Merged

Eugene (etsybaev) merged 16 commits into
masterfrom
etsybaev/16992-dest-bigquery-fix-check-verification

Conversation

@etsybaev

@etsybaev Eugene (etsybaev) commented Oct 27, 2022 •

Copy link
Copy Markdown
Contributor

What

The check stage sometimes may pass the verification but then fail on sync.

How

Updated check stage - added additional verifications

Tested locally:
Selection_051

Test with valid creds
Selection_052

Test with valid GCS creds

Selection_053

🚨 User Impact 🚨

Existing users shouldn't be affected

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/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
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
  • 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 and connector version bumped by running the /publish command 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

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@github-actions

Copy link
Copy Markdown
Contributor

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to run corresponding integration tests:

  • destination-bigquery-denormalized
  • destination-bigquery

@etsybaev

Eugene (etsybaev) commented Oct 27, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery

🕑 connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3338748747
❌ connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3338748747
🐛 https://gradle.com/s/ydow5eujdl7v4

Build Failed

Test summary info:

Could not find result summary

@etsybaev

Eugene (etsybaev) commented Oct 27, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery-denormalized

🕑 connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/3338752092
✅ connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/3338752092
Python tests coverage:

Name                                                              Stmts   Miss  Cover
-------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                            2      0   100%
normalization/transform_catalog/reserved_keywords.py                 14      0   100%
normalization/transform_catalog/__init__.py                           2      0   100%
normalization/destination_type.py                                    14      0   100%
normalization/__init__.py                                             4      0   100%
normalization/transform_catalog/destination_name_transformer.py     166      8    95%
normalization/transform_catalog/table_name_registry.py              174     34    80%
normalization/transform_config/transform.py                         189     48    75%
normalization/transform_catalog/utils.py                             51     14    73%
normalization/transform_catalog/dbt_macro.py                         22      7    68%
normalization/transform_catalog/catalog_processor.py                147     80    46%
normalization/transform_catalog/transform.py                         61     38    38%
normalization/transform_catalog/stream_processor.py                 589    394    33%
-------------------------------------------------------------------------------------
TOTAL                                                              1435    623    57%

Build Passed

Test summary info:

All Passed

@etsybaev

Eugene (etsybaev) commented Oct 27, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery

🕑 connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3339284764
❌ connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3339284764
🐛 https://gradle.com/s/xpcnco7venpse

Build Failed

Test summary info:

Could not find result summary

@etsybaev

Eugene (etsybaev) commented Oct 27, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery

🕑 connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3339975608
❌ connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3339975608
🐛 https://gradle.com/s/zp6qdy45tewpq

Build Failed

Test summary info:

Could not find result summary

@etsybaev

Eugene (etsybaev) commented Oct 27, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery

🕑 connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3340639317
❌ connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3340639317
🐛 https://gradle.com/s/2znxuj4jh2oca

Build Failed

Test summary info:

Could not find result summary

@etsybaev

Eugene (etsybaev) commented Oct 28, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery

🕑 connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3343560093
❌ connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3343560093
🐛 https://gradle.com/s/rhvcbxbfhtgs4

Build Failed

Test summary info:

Could not find result summary

@github-actions

Copy link
Copy Markdown
Contributor

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to run corresponding integration tests:

  • destination-bigquery
  • destination-bigquery-denormalized

@etsybaev

Eugene (etsybaev) commented Oct 28, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery

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

Name                                                              Stmts   Miss  Cover
-------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                            2      0   100%
normalization/transform_catalog/reserved_keywords.py                 14      0   100%
normalization/transform_catalog/__init__.py                           2      0   100%
normalization/destination_type.py                                    14      0   100%
normalization/__init__.py                                             4      0   100%
normalization/transform_catalog/destination_name_transformer.py     166      8    95%
normalization/transform_catalog/table_name_registry.py              174     34    80%
normalization/transform_config/transform.py                         189     48    75%
normalization/transform_catalog/utils.py                             51     14    73%
normalization/transform_catalog/dbt_macro.py                         22      7    68%
normalization/transform_catalog/catalog_processor.py                147     80    46%
normalization/transform_catalog/transform.py                         61     38    38%
normalization/transform_catalog/stream_processor.py                 589    394    33%
-------------------------------------------------------------------------------------
TOTAL                                                              1435    623    57%

Build Passed

Test summary info:

All Passed

@github-actions

Copy link
Copy Markdown
Contributor

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to run corresponding integration tests:

  • destination-bigquery-denormalized
  • destination-bigquery

@github-actions

Copy link
Copy Markdown
Contributor

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to run corresponding integration tests:

  • destination-bigquery
  • destination-bigquery-denormalized

@etsybaev

Eugene (etsybaev) commented Oct 28, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery-denormalized

🕑 connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/3345240190
✅ connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/3345240190
Python tests coverage:

Name                                                              Stmts   Miss  Cover
-------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                            2      0   100%
normalization/transform_catalog/reserved_keywords.py                 14      0   100%
normalization/transform_catalog/__init__.py                           2      0   100%
normalization/destination_type.py                                    14      0   100%
normalization/__init__.py                                             4      0   100%
normalization/transform_catalog/destination_name_transformer.py     166      8    95%
normalization/transform_catalog/table_name_registry.py              174     34    80%
normalization/transform_config/transform.py                         189     48    75%
normalization/transform_catalog/utils.py                             51     14    73%
normalization/transform_catalog/dbt_macro.py                         22      7    68%
normalization/transform_catalog/catalog_processor.py                147     80    46%
normalization/transform_catalog/transform.py                         61     38    38%
normalization/transform_catalog/stream_processor.py                 589    394    33%
-------------------------------------------------------------------------------------
TOTAL                                                              1435    623    57%

Build Passed

Test summary info:

All Passed

@etsybaev
Eugene (etsybaev) marked this pull request as ready for review October 28, 2022 13:09
@etsybaev Eugene (etsybaev) changed the title [16992] Destination-bigquery: added additional verifications to Check method 🐛Destination-bigquery: added additional verifications to Check method Oct 28, 2022
@etsybaev
Eugene (etsybaev) requested a review from a team November 1, 2022 16:50
@grishick

Copy link
Copy Markdown
Contributor

Akash Kulkarni (@akashkulk) could you please check if this change will report the error in the way that aligns with what you are working on for sources and that errors will be reported as config errors?

@MethodSource("datasetIdResetterProvider")
void testCheckFailureInsufficientPermissionForCreateDataset(final DatasetIdResetter resetDatasetId) throws IOException {

if (!Files.exists(CREDENTIALS_WITHMISSED_CREATE_DATASET_ROLE_PATH)) {

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.

I see this occurring in other parts of the code, what exactly is this supposed to do that is causing a test to throw an IllegalStateException?

@etsybaev Eugene (etsybaev) Nov 2, 2022 •

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.

This is another test creds.
I will fail on CI if somebody removes or change the secret in GSM or to somebody, who will try to run integrationTest locally without having these creds locally in the secret folder. I believe this common integration test's approach for connectors that calls real DB i.e. requires real creds that obviously can't be committed.
This exception will provide a more clear understanding what went wrong rather than just NullPointerException

@github-actions

github-actions Bot commented Nov 3, 2022 •

Copy link
Copy Markdown
Contributor

Affected Connector Report

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to do the following as needed:

  • Run integration tests
  • Bump connector version
  • Add changelog
  • Publish the new version

✅ Sources (0)

Connector Version Changelog Publish
  • See "Actionable Items" below for how to resolve warnings and errors.

⚠ Destinations (2)

Connector Version Changelog Publish
destination-bigquery 1.2.6 ✅ ✅
destination-bigquery-denormalized 1.2.6 ⚠
(doc not found)
✅
  • See "Actionable Items" below for how to resolve warnings and errors.

Actionable Items

(click to expand)

Category Status Actionable Item
Version ❌
mismatch
The version of the connector is different from its normal variant. Please bump the version of the connector.
⚠
doc not found
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug.
Changelog ⚠
doc not found
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug.
❌
changelog missing
There is no chnagelog for the current version of the connector. If you are the author of the current version, please add a changelog.
Publish ⚠
not in seed
The connector is not in the seed file (e.g. source_definitions.yaml), so its publication status cannot be checked. This can be normal (e.g. some connectors are cloud-specific, and only listed in the cloud seed file). Please double-check to make sure that it is not a bug.
❌
diff seed version
The connector exists in the seed file, but the latest version is not listed there. This usually means that the latest version is not published. Please use the /publish command to publish the latest version.

@etsybaev

Eugene (etsybaev) commented Nov 9, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery

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

Name                                                              Stmts   Miss  Cover
-------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                            2      0   100%
normalization/transform_catalog/reserved_keywords.py                 14      0   100%
normalization/transform_catalog/__init__.py                           2      0   100%
normalization/destination_type.py                                    14      0   100%
normalization/__init__.py                                             4      0   100%
normalization/transform_catalog/destination_name_transformer.py     166      8    95%
normalization/transform_catalog/table_name_registry.py              174     34    80%
normalization/transform_config/transform.py                         189     48    75%
normalization/transform_catalog/utils.py                             51     14    73%
normalization/transform_catalog/dbt_macro.py                         22      7    68%
normalization/transform_catalog/catalog_processor.py                147     80    46%
normalization/transform_catalog/transform.py                         61     38    38%
normalization/transform_catalog/stream_processor.py                 595    400    33%
-------------------------------------------------------------------------------------
TOTAL                                                              1441    629    56%

Build Passed

Test summary info:

All Passed

.withStatus(AirbyteConnectionStatus.Status.FAILED)
.withMessage("Could access the GCS bucket with the provided configuration.\n" + e
.getMessage());
throw new ConfigErrorException("Could access the GCS bucket with the provided configuration.\n", e);

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.

It seems this message should be "Could not access the GCS bucket with the provided configuration.\n", right because we're saying that it failed

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.

Hm... Interesting fact, it's been there for already almost half a year. Updated, thanks

class BigQueryDestinationTest {

protected static final Path CREDENTIALS_PATH = Path.of("secrets/credentials.json");
protected static final Path CREDENTIALS_WITHMISSED_CREATE_DATASET_ROLE_PATH =

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.

Missing an _ between with and missed

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.

updated, thanks

});

final String actualMessage = ex.getMessage();
LOGGER.info("Checking expected failure message:" + actualMessage);

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.

Not sure if this LOGGER is needed. To keep the test simpler, may suggest just having this as

assertThat(ex.getMessage()).contains("Access Denied");

cc: Christophe Duong (@ChristopheDuong) is there any reason we may want to keep this LOGGER.info?

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.

Not sure if this LOGGER is needed.

probably not? just for surfacing information in the logs

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.

removed logger, thanks

final AirbyteConnectionStatus expected = new AirbyteConnectionStatus().withStatus(Status.FAILED).withMessage("");
assertEquals(expected, actual.withMessage(""));
assertThat(actualMessage)
.contains("Project dataline-integration-testing: User does not have bigquery.datasets.create permission");

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.

I would probably remove the dataline-integration-testing: portion since that's really internal to Airbyte and better to keep this not directly exposed since it provides no value to anybody else

Also same comment as above, if the LOGGER class is not needed then this assertThat can be simplified into one line

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.

updated, thanks

@ryankfu Ryan Fu (ryankfu) 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.

Overall looks good, some minor nits with the checkGcsPermission message. Lets not provide an odd message but overall after that change it should be good to move forward

@grishick

Copy link
Copy Markdown
Contributor

Looks good. Please address Ryan Fu (@ryankfu) 's comments before publishing and merging.

@etsybaev

Eugene (etsybaev) commented Nov 10, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery

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

Name                                                              Stmts   Miss  Cover
-------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                            2      0   100%
normalization/transform_catalog/reserved_keywords.py                 14      0   100%
normalization/transform_catalog/__init__.py                           2      0   100%
normalization/destination_type.py                                    14      0   100%
normalization/__init__.py                                             4      0   100%
normalization/transform_catalog/destination_name_transformer.py     166      8    95%
normalization/transform_catalog/table_name_registry.py              174     34    80%
normalization/transform_config/transform.py                         189     48    75%
normalization/transform_catalog/utils.py                             51     14    73%
normalization/transform_catalog/dbt_macro.py                         22      7    68%
normalization/transform_catalog/catalog_processor.py                147     80    46%
normalization/transform_catalog/transform.py                         61     38    38%
normalization/transform_catalog/stream_processor.py                 595    400    33%
-------------------------------------------------------------------------------------
TOTAL                                                              1441    629    56%

Build Passed

Test summary info:

All Passed

@etsybaev

Eugene (etsybaev) commented Nov 10, 2022 •

Copy link
Copy Markdown
Contributor Author

/test connector=connectors/destination-bigquery-denormalized

🕑 connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/3436328065
✅ connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/3436328065
Python tests coverage:

Name                                                              Stmts   Miss  Cover
-------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                            2      0   100%
normalization/transform_catalog/reserved_keywords.py                 14      0   100%
normalization/transform_catalog/__init__.py                           2      0   100%
normalization/destination_type.py                                    14      0   100%
normalization/__init__.py                                             4      0   100%
normalization/transform_catalog/destination_name_transformer.py     166      8    95%
normalization/transform_catalog/table_name_registry.py              174     34    80%
normalization/transform_config/transform.py                         189     48    75%
normalization/transform_catalog/utils.py                             51     14    73%
normalization/transform_catalog/dbt_macro.py                         22      7    68%
normalization/transform_catalog/catalog_processor.py                147     80    46%
normalization/transform_catalog/transform.py                         61     38    38%
normalization/transform_catalog/stream_processor.py                 595    400    33%
-------------------------------------------------------------------------------------
TOTAL                                                              1441    629    56%

Build Passed

Test summary info:

All Passed

@etsybaev

Eugene (etsybaev) commented Nov 10, 2022 •

Copy link
Copy Markdown
Contributor Author

/publish connector=connectors/destination-bigquery

🕑 Publishing the following connectors:
connectors/destination-bigquery
https://github.com/airbytehq/airbyte/actions/runs/3436586404


Connector Did it publish? Were definitions generated?
connectors/destination-bigquery ✅ ✅

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@etsybaev

Eugene (etsybaev) commented Nov 10, 2022 •

Copy link
Copy Markdown
Contributor Author

/publish connector=connectors/destination-bigquery-denormalized

🕑 Publishing the following connectors:
connectors/destination-bigquery-denormalized
https://github.com/airbytehq/airbyte/actions/runs/3436930706


Connector Did it publish? Were definitions generated?
connectors/destination-bigquery-denormalized ✅ ✅

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@octavia-squidington-iii
Octavia Squidington III (octavia-squidington-iii) temporarily deployed to more-secrets November 10, 2022 12:49 Inactive

This branch was previously deployed

1 inactive deployment
more-secrets — b537ee7a Deployed Nov 10, 2022 by octavia-squidington-iii
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 connectors/destination/bigquery connectors/destination/bigquery-denormalized team/destinations Destinations team's backlog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Destination BigQuery: Check should fail if we have insufficient permissions

7 participants