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

🐛 Destination bigquery denormalize "allOf" and "anyOf" fix #11166

Merged
merged 11 commits into from
Apr 5, 2022

Conversation

andriikorotkov
Copy link
Contributor

@andriikorotkov andriikorotkov commented Mar 15, 2022

What

Updated JSON schema parsing and allOf and anyOf processing.

How

{"type":"object","properties":{...... "team_ids":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}]},.....},"additionalProperties":false}

2022-03-15_19-11

2022-03-25_14-08

Recommended reading order

  1. DefaultBigQueryDenormalizedRecordFormatter.java

🚨 User Impact 🚨

No 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
  • 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 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

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@andriikorotkov andriikorotkov marked this pull request as ready for review March 21, 2022 15:50
@andriikorotkov
Copy link
Contributor Author

Hi @tuliren. I have corrected all the comments you noticed in this pull request. Please, when you have time, watch this pull request again.

@andriikorotkov andriikorotkov requested review from edgao and removed request for edgao April 4, 2022 12:36
Copy link
Contributor

@tuliren tuliren left a comment

Choose a reason for hiding this comment

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

Great!

Nitpick. The test cases in BigQueryDenormalizedTestDataUtils.java are moved to JSON files in #11454. It does look cleaner. Could you do the same for the new test cases in this PR for consistency?

@andriikorotkov
Copy link
Contributor Author

@tuliren Thank you for pointing me to this. I will add these changes

@andriikorotkov
Copy link
Contributor Author

andriikorotkov commented Apr 5, 2022

/test connector=connectors/destination-bigquery

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

Name                                                                                                                            Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                                                                                          2      0   100%
normalization/transform_catalog/reserved_keywords.py                                                                               13      0   100%
normalization/transform_catalog/__init__.py                                                                                         2      0   100%
normalization/destination_type.py                                                                                                  13      0   100%
normalization/__init__.py                                                                                                           4      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/airbyte_protocol.py     124      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/__init__.py                      2      0   100%
normalization/transform_catalog/destination_name_transformer.py                                                                   155      8    95%
normalization/transform_config/transform.py                                                                                       168     31    82%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/utils.py                                                                                           33      7    79%
normalization/transform_catalog/catalog_processor.py                                                                              143     77    46%
normalization/transform_catalog/transform.py                                                                                       45     26    42%
normalization/transform_catalog/stream_processor.py                                                                               524    337    36%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1403    520    63%

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Apr 5, 2022
@andriikorotkov
Copy link
Contributor Author

andriikorotkov commented Apr 5, 2022

/publish connector=connectors/destination-bigquery

🕑 connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/2097300377
❌ connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/2097300377

@andriikorotkov andriikorotkov temporarily deployed to more-secrets April 5, 2022 15:55 Inactive
@andriikorotkov andriikorotkov temporarily deployed to more-secrets April 5, 2022 15:55 Inactive
@andriikorotkov
Copy link
Contributor Author

andriikorotkov commented Apr 5, 2022

/test connector=connectors/destination-bigquery-denormalized

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

Name                                                                                                                            Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                                                                                          2      0   100%
normalization/transform_catalog/reserved_keywords.py                                                                               13      0   100%
normalization/transform_catalog/__init__.py                                                                                         2      0   100%
normalization/destination_type.py                                                                                                  13      0   100%
normalization/__init__.py                                                                                                           4      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/airbyte_protocol.py     124      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/__init__.py                      2      0   100%
normalization/transform_catalog/destination_name_transformer.py                                                                   155      8    95%
normalization/transform_config/transform.py                                                                                       168     31    82%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/utils.py                                                                                           33      7    79%
normalization/transform_catalog/catalog_processor.py                                                                              143     77    46%
normalization/transform_catalog/transform.py                                                                                       45     26    42%
normalization/transform_catalog/stream_processor.py                                                                               524    337    36%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1403    520    63%

@andriikorotkov
Copy link
Contributor Author

andriikorotkov commented Apr 5, 2022

/publish connector=connectors/destination-bigquery-denormalized

🕑 connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/2097554841
✅ connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/2097554841

@andriikorotkov andriikorotkov merged commit 72dcd81 into master Apr 5, 2022
@andriikorotkov andriikorotkov deleted the akorotkov/5912_bigquery_denorm_anyof_and_allof branch April 5, 2022 18:52
DoNotPanicUA added a commit that referenced this pull request Jun 23, 2022
DoNotPanicUA added a commit that referenced this pull request Sep 8, 2022
* stop covering any array. cover only if we have array of arrays (restriction of BigQuery)

* add test with nested arrays and update existing tests

* [14058] fix datetime arrays

* [11109] cover only array of arrays by object instead of any array

* [14058] fix datetime format fail when we have an array of objects with datetime

* enable Array and Array+Object DATs

* reopen Issue #11166 and disable functionality

* Improve the tests by moving common part to Utils

* Add tests to check `Array of arrays` cases

* Increase version

* Doc

* format

* review update:
- update comment about reopen issue
- added test case with multiply array sub values
- fix nested arrays with datetime
- add test case for nested arrays with datetime

* fix date formatting

* disable testAnyOf test and upd comments

* remove some code duplication in the tests

* [14668] cover by tests the BigQuery inheritance limitation

* Make GCS implementation running same tests as standard impl

* Make common format for returning date values to cover DateTime and Timestamp columns by one test

* [15363] add backward compatibility for existing connections.

* Populate stream config and messages by tablespace. Now it's required inside processing.

* Compare only fields from the stream config

* Rework BigQueryUploaderFactory and UploaderConfig to have possibility make a decision about array formmater before we create temporary table

* Compare fields

* remove extra logging

* fix project:dataset format of the datasetId

* missing import

* remove debug logging

* fix log messages

* format

* 4 > 3
robbinhan pushed a commit to robbinhan/airbyte that referenced this pull request Sep 29, 2022
…hq#14023)

* stop covering any array. cover only if we have array of arrays (restriction of BigQuery)

* add test with nested arrays and update existing tests

* [14058] fix datetime arrays

* [11109] cover only array of arrays by object instead of any array

* [14058] fix datetime format fail when we have an array of objects with datetime

* enable Array and Array+Object DATs

* reopen Issue airbytehq#11166 and disable functionality

* Improve the tests by moving common part to Utils

* Add tests to check `Array of arrays` cases

* Increase version

* Doc

* format

* review update:
- update comment about reopen issue
- added test case with multiply array sub values
- fix nested arrays with datetime
- add test case for nested arrays with datetime

* fix date formatting

* disable testAnyOf test and upd comments

* remove some code duplication in the tests

* [14668] cover by tests the BigQuery inheritance limitation

* Make GCS implementation running same tests as standard impl

* Make common format for returning date values to cover DateTime and Timestamp columns by one test

* [15363] add backward compatibility for existing connections.

* Populate stream config and messages by tablespace. Now it's required inside processing.

* Compare only fields from the stream config

* Rework BigQueryUploaderFactory and UploaderConfig to have possibility make a decision about array formmater before we create temporary table

* Compare fields

* remove extra logging

* fix project:dataset format of the datasetId

* missing import

* remove debug logging

* fix log messages

* format

* 4 > 3
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
…hq#14023)

* stop covering any array. cover only if we have array of arrays (restriction of BigQuery)

* add test with nested arrays and update existing tests

* [14058] fix datetime arrays

* [11109] cover only array of arrays by object instead of any array

* [14058] fix datetime format fail when we have an array of objects with datetime

* enable Array and Array+Object DATs

* reopen Issue airbytehq#11166 and disable functionality

* Improve the tests by moving common part to Utils

* Add tests to check `Array of arrays` cases

* Increase version

* Doc

* format

* review update:
- update comment about reopen issue
- added test case with multiply array sub values
- fix nested arrays with datetime
- add test case for nested arrays with datetime

* fix date formatting

* disable testAnyOf test and upd comments

* remove some code duplication in the tests

* [14668] cover by tests the BigQuery inheritance limitation

* Make GCS implementation running same tests as standard impl

* Make common format for returning date values to cover DateTime and Timestamp columns by one test

* [15363] add backward compatibility for existing connections.

* Populate stream config and messages by tablespace. Now it's required inside processing.

* Compare only fields from the stream config

* Rework BigQueryUploaderFactory and UploaderConfig to have possibility make a decision about array formmater before we create temporary table

* Compare fields

* remove extra logging

* fix project:dataset format of the datasetId

* missing import

* remove debug logging

* fix log messages

* format

* 4 > 3
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.

4 participants