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

Mssql destination: enable DAT tests, use nvarchar and datetime2 by default #12305

Merged
merged 18 commits into from
May 7, 2022

Conversation

sashaNeshcheret
Copy link
Contributor

@sashaNeshcheret sashaNeshcheret commented Apr 25, 2022

What

Enabled DAT tests for Mssql destination, updated data types.

How

Overridden methods for enabling DAT tests for Mssql destination, replace varchar to nvarchar for supporting special characters, and datetime to datetime2 for increasing range of values.

Recommended reading order

  1. datatypes.sql
  2. MSSQLDestinationAcceptanceTest.java
  3. MSSQLTestDataComparator.java
  4. x.java

🚨 User Impact 🚨

Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.

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 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 github-actions bot added area/connectors Connector related issues area/platform issues related to the platform area/worker Related to worker normalization labels Apr 25, 2022
@sashaNeshcheret sashaNeshcheret added connectors/destination/mssql and removed area/worker Related to worker area/platform issues related to the platform labels Apr 25, 2022
@@ -51,3 +51,4 @@
{"type": "RECORD", "record": {"stream": "1_prefix_startwith_number", "emitted_at": 1602637990800, "data": { "id": 2, "date": "2020-09-01", "text": "hi 4"}}}

{"type":"RECORD","record":{"stream":"multiple_column_names_conflicts","data":{"id":1,"User Id":"chris","user_id":42,"User id":300,"user id": 102,"UserId":101},"emitted_at":1623959926}}
{"type":"RECORD","record":{"stream":"special_characters","data":{"id":1,"character_1":"some random special characters: ࠈൡሗ","user_id":42,"character_2":"some random special characters: žõ⥁🌞"},"emitted_at":1623959932}}
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm not mistaken, this test will effect normalization of all destinations. Are you sure that we are safe to do it?

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, you are right. @grubberr will check if it works for all destinations and will make changes in scope of the PR if not.

@@ -91,6 +92,8 @@ protected boolean compareJsonNodes(final JsonNode expectedValue, final JsonNode
return compareDateValues(expectedValue.asText(), actualValue.asText());
} else if (expectedValue.isArray() && actualValue.isArray()) {
return compareArrays(expectedValue, actualValue);
} else if (expectedValue.isArray() && isQuotedArray(actualValue)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a specific case of your destination. It should be handled inside your destination implementation.
I already fixed few destinations with the similar problem. You need to parse text values on the destination and provide actual value as true array here.

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, will do it.

@sashaNeshcheret
Copy link
Contributor Author

sashaNeshcheret commented Apr 27, 2022

/test connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/2234439818
❌ bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/2234439818
🐛

@github-actions github-actions bot added area/platform issues related to the platform area/worker Related to worker labels Apr 28, 2022
@sashaNeshcheret sashaNeshcheret temporarily deployed to more-secrets April 28, 2022 11:33 Inactive
@sashaNeshcheret sashaNeshcheret temporarily deployed to more-secrets April 28, 2022 11:33 Inactive
@sashaNeshcheret
Copy link
Contributor Author

sashaNeshcheret commented Apr 28, 2022

/test connector=connectors/destination-mssql

🕑 connectors/destination-mssql https://github.com/airbytehq/airbyte/actions/runs/2239011384
✅ connectors/destination-mssql https://github.com/airbytehq/airbyte/actions/runs/2239011384
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                                                                                       159     31    81%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/utils.py                                                                                           34      7    79%
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                                                                               534    345    35%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1447    550    62%

@sashaNeshcheret
Copy link
Contributor Author

sashaNeshcheret commented Apr 28, 2022

/test connector=connectors/destination-mssql-strict-encrypt

🕑 connectors/destination-mssql-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/2239011523
✅ connectors/destination-mssql-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/2239011523
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                                                                                       159     31    81%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/utils.py                                                                                           34      7    79%
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                                                                               534    345    35%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1447    550    62%

@sashaNeshcheret
Copy link
Contributor Author

sashaNeshcheret commented Apr 28, 2022

/test connector=connectors/destination-mssql-strict-encrypt

🕑 connectors/destination-mssql-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/2240273897
✅ connectors/destination-mssql-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/2240273897
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                                                                                       159     31    81%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/utils.py                                                                                           34      7    79%
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                                                                               534    345    35%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1447    550    62%

@sashaNeshcheret
Copy link
Contributor Author

sashaNeshcheret commented Apr 28, 2022

/test connector=connectors/destination-mssql

🕑 connectors/destination-mssql https://github.com/airbytehq/airbyte/actions/runs/2240274766
✅ connectors/destination-mssql https://github.com/airbytehq/airbyte/actions/runs/2240274766
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                                                                                       159     31    81%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/utils.py                                                                                           34      7    79%
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                                                                               534    345    35%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1447    550    62%

@sashaNeshcheret sashaNeshcheret temporarily deployed to more-secrets April 28, 2022 15:25 Inactive
@sashaNeshcheret sashaNeshcheret temporarily deployed to more-secrets April 28, 2022 15:25 Inactive
@sashaNeshcheret sashaNeshcheret temporarily deployed to more-secrets April 28, 2022 18:31 Inactive
@sashaNeshcheret sashaNeshcheret temporarily deployed to more-secrets April 28, 2022 18:31 Inactive
@grubberr grubberr temporarily deployed to more-secrets May 6, 2022 03:23 Inactive
Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label May 6, 2022
@grubberr grubberr temporarily deployed to more-secrets May 6, 2022 05:31 Inactive
@grubberr grubberr temporarily deployed to more-secrets May 6, 2022 05:31 Inactive
@sashaNeshcheret
Copy link
Contributor Author

sashaNeshcheret commented May 6, 2022

/publish connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/2281151251
❌ Failed to publish bases/base-normalization
❌ Couldn't auto-bump version for bases/base-normalization

@sashaNeshcheret sashaNeshcheret temporarily deployed to more-secrets May 6, 2022 12:16 Inactive
@sashaNeshcheret sashaNeshcheret temporarily deployed to more-secrets May 6, 2022 12:16 Inactive
@grubberr
Copy link
Contributor

grubberr commented May 6, 2022

/publish connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/2281689607
❌ Failed to publish bases/base-normalization
❌ Couldn't auto-bump version for bases/base-normalization

@@ -1,6 +1,6 @@
SELECT
forms
FROM
{{ REF('pokemon') }}
{{ ref('pokemon') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it's an innocent victim of the Format.

Copy link
Contributor

Choose a reason for hiding this comment

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

if you know how to fix
there is an issue for this :)
#12384

@sashaNeshcheret
Copy link
Contributor Author

sashaNeshcheret commented May 6, 2022

/test connector=connectors/destination-mssql

🕑 connectors/destination-mssql https://github.com/airbytehq/airbyte/actions/runs/2281777205
✅ connectors/destination-mssql https://github.com/airbytehq/airbyte/actions/runs/2281777205
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     144      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                                                                                       159     31    81%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/utils.py                                                                                           34      7    79%
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                                                                               534    345    35%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1467    550    63%

@sashaNeshcheret
Copy link
Contributor Author

sashaNeshcheret commented May 6, 2022

/publish connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/2282311877
❌ Failed to publish bases/base-normalization
❌ Couldn't auto-bump version for bases/base-normalization

@grubberr
Copy link
Contributor

grubberr commented May 6, 2022

/publish connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/2284165407
❌ Failed to publish bases/base-normalization
❌ Couldn't auto-bump version for bases/base-normalization

@grubberr
Copy link
Contributor

grubberr commented May 7, 2022

/publish connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/2285330961
🚀 Successfully published bases/base-normalization
❌ Couldn't auto-bump version for bases/base-normalization

@grubberr grubberr temporarily deployed to more-secrets May 7, 2022 06:10 Inactive
@grubberr grubberr temporarily deployed to more-secrets May 7, 2022 06:10 Inactive
@grubberr
Copy link
Contributor

grubberr commented May 7, 2022

/publish connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/2285566806
❌ Failed to publish bases/base-normalization
❌ Couldn't auto-bump version for bases/base-normalization

@grubberr
Copy link
Contributor

grubberr commented May 7, 2022

I see that it's published

docker rmi airbyte/normalization:0.1.78
docker run -ti --rm --entrypoint /bin/bash airbyte/normalization:0.1.78
root@b89db0535d0f:/airbyte# grep NVARCHAR normalization_code/dbt-template/macros/cross_db_utils/datatypes.sql
    NVARCHAR(max)
    NVARCHAR(max)

@grubberr grubberr temporarily deployed to more-secrets May 7, 2022 08:21 Inactive
@grubberr grubberr temporarily deployed to more-secrets May 7, 2022 08:21 Inactive
@grubberr grubberr merged commit d35d7b0 into master May 7, 2022
@grubberr grubberr deleted the omneshcheret/dat-mssql branch May 7, 2022 08:22
suhomud pushed a commit that referenced this pull request May 23, 2022
…fault (#12305)

* Mssql destination: enable DAT tests for mssql destination, use nvarchar and datetime2 by default

* Mssql destination: update array handling in test

* Mssql destination: update array and JSON handling in test

* Mssql destination: remove unused method

* bugfix bigquery tests, dataset_location added

* basic-normalization.md updated

Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>

* Mssql destination: change parent class for mssql test

Co-authored-by: Sergey Chvalyuk <grubberr@gmail.com>
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 area/platform issues related to the platform area/worker Related to worker connectors/destination/mssql normalization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run the new DAT(s) against all destinations and find destinations that are not compliant
4 participants