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

🐛 Fix Snowflake destination normalization to accept any date-time format. #6052

Merged
merged 14 commits into from
Sep 23, 2021

Conversation

yaroslav-dudar
Copy link
Contributor

What

Fixed snowflake destination support for date-time format #5713

How

Describe the solution

Recommended reading order

  1. base-normalization/normalization/transform_catalog/stream_processor.py
  2. base-normalization/dbt-project-template/macros/cross_db_utils/datatypes.sql

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
  • Connector added to connector index like described here

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

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
  • Connector version bumped like described here

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

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.

@yaroslav-dudar yaroslav-dudar changed the title Fix Snowflake destination normalization to accept any date-time format. 🐛 Fix Snowflake destination normalization to accept any date-time format. Sep 14, 2021
@jrhizor jrhizor temporarily deployed to more-secrets September 14, 2021 10:06 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets September 14, 2021 10:30 Inactive
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 14, 2021

/test connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1233489470
❌ bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1233489470
🐛 https://gradle.com/s/yrcxnlhnh2lli

@jrhizor jrhizor temporarily deployed to more-secrets September 14, 2021 11:53 Inactive
@sherifnada
Copy link
Contributor

@yaroslav-dudar your build issue should be fixed once you merge latest master

@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 15, 2021

/test connector=bases/base-normalization

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

@jrhizor jrhizor temporarily deployed to more-secrets September 15, 2021 06:25 Inactive
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 15, 2021

/test connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1237854943
❌ bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1237854943
🐛 https://gradle.com/s/nd5narrjd7oxo

@jrhizor jrhizor temporarily deployed to more-secrets September 15, 2021 13:44 Inactive
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 15, 2021

/test connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1238034385
❌ bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1238034385
🐛 https://gradle.com/s/w4svts4asovue

@jrhizor jrhizor temporarily deployed to more-secrets September 15, 2021 14:33 Inactive
@github-actions github-actions bot added area/documentation Improvements or additions to documentation area/worker Related to worker labels Sep 15, 2021
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 15, 2021

/test connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1238675382
✅ bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1238675382

@jrhizor jrhizor temporarily deployed to more-secrets September 15, 2021 17:52 Inactive
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 21, 2021

/publish connector=bases/base-normalization

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

@jrhizor jrhizor temporarily deployed to more-secrets September 21, 2021 18:23 Inactive
@sherifnada
Copy link
Contributor

@yaroslav-dudar I think the failure is in the test itself. Have you verified they are passing locally?

@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 22, 2021

@yaroslav-dudar I think the failure is in the test itself. Have you verified they are passing locally?

@sherifnada but it's passed here #6052 (comment)

and I see errors like this

docker: Error response from daemon: manifest for airbyte/destination-redshift:dev not found: manifest unknown: manifest unknown.
docker: Error response from daemon: manifest for airbyte/destination-postgres:dev not found: manifest unknown: manifest unknown.
docker: Error response from daemon: manifest for airbyte/destination-bigquery:dev not found: manifest unknown: manifest unknown.
docker: Error response from daemon: manifest for airbyte/destination-snowflake:dev not found: manifest unknown: manifest unknown.

@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 22, 2021

/test connector=bases/base-normalization

🕑 bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1260788282
✅ bases/base-normalization https://github.com/airbytehq/airbyte/actions/runs/1260788282
Python tests coverage:

	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                                              Stmts   Miss  Cover
	 -------------------------------------------------------------------------------------
	 main_dev_transform_catalog.py                                         3      3     0%
	 main_dev_transform_config.py                                          3      3     0%
	 normalization/__init__.py                                             4      0   100%
	 normalization/destination_type.py                                    11      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     117      6    95%
	 normalization/transform_catalog/reserved_keywords.py                 10      0   100%
	 normalization/transform_catalog/stream_processor.py                 349    199    43%
	 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                         138     39    72%
	 -------------------------------------------------------------------------------------
	 TOTAL                                                              1034    394    62%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                       Stmts   Miss  Cover
	 --------------------------------------------------------------
	 base_python/__init__.py                       13      0   100%
	 base_python/catalog_helpers.py                10      6    40%
	 base_python/cdk/__init__.py                    0      0   100%
	 base_python/cdk/abstract_source.py            83     59    29%
	 base_python/cdk/streams/__init__.py            0      0   100%
	 base_python/cdk/streams/auth/__init__.py       0      0   100%
	 base_python/cdk/streams/auth/core.py           8      1    88%
	 base_python/cdk/streams/auth/jwt.py            5      5     0%
	 base_python/cdk/streams/auth/oauth.py         37     26    30%
	 base_python/cdk/streams/auth/token.py          9      4    56%
	 base_python/cdk/streams/core.py               63     32    49%
	 base_python/cdk/streams/exceptions.py         10      2    80%
	 base_python/cdk/streams/http.py               67     33    51%
	 base_python/cdk/streams/rate_limiting.py      30     14    53%
	 base_python/cdk/utils/__init__.py              0      0   100%
	 base_python/cdk/utils/casing.py                4      0   100%
	 base_python/client.py                         56     33    41%
	 base_python/entrypoint.py                     70     56    20%
	 base_python/integration.py                    52     25    52%
	 base_python/logger.py                         33     19    42%
	 base_python/schema_helpers.py                 56     41    27%
	 base_python/source.py                         51     34    33%
	 main_dev.py                                    3      3     0%
	 --------------------------------------------------------------
	 TOTAL                                        660    393    40%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                                 Stmts   Miss  Cover
	 ------------------------------------------------------------------------
	 source_acceptance_test/__init__.py                       2      0   100%
	 source_acceptance_test/base.py                          10      4    60%
	 source_acceptance_test/config.py                        74      8    89%
	 source_acceptance_test/conftest.py                     108    108     0%
	 source_acceptance_test/plugin.py                        45     45     0%
	 source_acceptance_test/tests/__init__.py                 4      0   100%
	 source_acceptance_test/tests/test_core.py              158    109    31%
	 source_acceptance_test/tests/test_full_refresh.py       18     11    39%
	 source_acceptance_test/tests/test_incremental.py        69     38    45%
	 source_acceptance_test/utils/__init__.py                 6      0   100%
	 source_acceptance_test/utils/asserts.py                 37      2    95%
	 source_acceptance_test/utils/common.py                  41     25    39%
	 source_acceptance_test/utils/compare.py                 47     20    57%
	 source_acceptance_test/utils/connector_runner.py        82     49    40%
	 source_acceptance_test/utils/json_schema_helper.py      75     11    85%
	 ------------------------------------------------------------------------
	 TOTAL                                                  776    430    45%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                                              Stmts   Miss  Cover
	 -------------------------------------------------------------------------------------
	 main_dev_transform_catalog.py                                         3      3     0%
	 main_dev_transform_config.py                                          3      3     0%
	 normalization/__init__.py                                             4      0   100%
	 normalization/destination_type.py                                    11      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     117      6    95%
	 normalization/transform_catalog/reserved_keywords.py                 10      0   100%
	 normalization/transform_catalog/stream_processor.py                 349    199    43%
	 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                         138     39    72%
	 -------------------------------------------------------------------------------------
	 TOTAL                                                              1034    394    62%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                                              Stmts   Miss  Cover
	 -------------------------------------------------------------------------------------
	 main_dev_transform_catalog.py                                         3      3     0%
	 main_dev_transform_config.py                                          3      3     0%
	 normalization/__init__.py                                             4      0   100%
	 normalization/destination_type.py                                    11      0   100%
	 normalization/transform_catalog/__init__.py                           2      0   100%
	 normalization/transform_catalog/catalog_processor.py                143     12    92%
	 normalization/transform_catalog/destination_name_transformer.py     117      4    97%
	 normalization/transform_catalog/reserved_keywords.py                 10      0   100%
	 normalization/transform_catalog/stream_processor.py                 349     32    91%
	 normalization/transform_catalog/table_name_registry.py              174     51    71%
	 normalization/transform_catalog/transform.py                         45     30    33%
	 normalization/transform_catalog/utils.py                             33      0   100%
	 normalization/transform_config/__init__.py                            2      0   100%
	 normalization/transform_config/transform.py                         138     45    67%
	 -------------------------------------------------------------------------------------
	 TOTAL                                                              1034    180    83%

@jrhizor jrhizor temporarily deployed to more-secrets September 22, 2021 07:25 Inactive
@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 22, 2021

/publish connector=bases/base-normalization

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

@jrhizor jrhizor temporarily deployed to more-secrets September 22, 2021 07:58 Inactive
@ChristopheDuong
Copy link
Contributor

Yes, if you see these errors:

docker: Error response from daemon: manifest for airbyte/destination-redshift:dev not found: manifest unknown: manifest unknown.
docker: Error response from daemon: manifest for airbyte/destination-postgres:dev not found: manifest unknown: manifest unknown.
docker: Error response from daemon: manifest for airbyte/destination-bigquery:dev not found: manifest unknown: manifest unknown.
docker: Error response from daemon: manifest for airbyte/destination-snowflake:dev not found: manifest unknown: manifest unknown.

Then, for some reason, when you publish, maybe the destination image (dev versions) are not available when publishing but they are correctly built/used during the test?

@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 22, 2021

it's weird because /test is ok, but /publish failed with Unable to find image 'airbyte/destination-postgres:dev' locally, Unable to find image 'airbyte/destination-bigquery:dev' locally ...

@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 22, 2021

@ChristopheDuong
I see that Task :airbyte-integrations:bases:base-normalization:customIntegrationTests comes before
:airbyte-integrations:connectors:destination-snowflake:airbyteDocker , :airbyte-integrations:connectors:destination-mysql:airbyteDocker etc . I think this may be a problem as we run tests before building destination images

https://github.com/airbytehq/airbyte/runs/3672622870?check_suite_focus=true#step:10:4645 - base-normalization:customIntegrationTests
https://github.com/airbytehq/airbyte/runs/3672622870?check_suite_focus=true#step:10:4772 - :airbyte-integrations:connectors:destination-snowflake:airbyteDocker

@yaroslav-dudar
Copy link
Contributor Author

maybe I need to change integrationTest.dependsOn("customIntegrationTestPython") to customIntegrationTests.dependsOn("customIntegrationTestPython") here https://github.com/airbytehq/airbyte/blob/yaroslav-dudar/5713/airbyte-integrations/bases/base-normalization/build.gradle#L50?
@sherifnada @ChristopheDuong ?

@ChristopheDuong
Copy link
Contributor

Oh, I remember I did struggle the same as you in the past...

here, see this PR: https://github.com/airbytehq/airbyte/pull/4910/files#r677136914
I fixed the CI for /test commands in that PR but not for /publish so it explains why you are having difficulty with the publish...

@yaroslav-dudar
Copy link
Contributor Author

yaroslav-dudar commented Sep 22, 2021

/publish connector=bases/base-normalization

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

@yaroslav-dudar yaroslav-dudar temporarily deployed to more-secrets September 22, 2021 16:02 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets September 22, 2021 16:04 Inactive
@yaroslav-dudar
Copy link
Contributor Author

@ChristopheDuong please check, is it ok for you 5b3bd3a ?

another point, seems like connector was published but I got error in the end https://github.com/airbytehq/airbyte/runs/3677499341?check_suite_focus=true#step:10:12179

is it possible that my changes are the reason of that issue??

@ChristopheDuong
Copy link
Contributor

ChristopheDuong commented Sep 22, 2021

@ChristopheDuong please check, is it ok for you 5b3bd3a ?

another point, seems like connector was published but I got error in the end https://github.com/airbytehq/airbyte/runs/3677499341?check_suite_focus=true#step:10:12179

is it possible that my changes are the reason of that issue??

Yes, it seemed to have publish fine!

Can you check that published docker image version has your change in it? (not in conflict from a publish from another PR?)

@ChristopheDuong
Copy link
Contributor

ChristopheDuong commented Sep 22, 2021

The error seemed to come from:

docker run --rm airbyte/normalization:0.1.45 spec
+ jq -R 'fromjson? | .'
+ jq -s 'map(select(.spec != null)) | map(.spec) | first | if . != null then . else error("no spec found") end'
Unknown command: spec
jq: error (at <stdin>:0): no spec found

which is from #5994

Normalization does not have "spec" commands as usual connectors do... so it seems normal and the publish should probably ignore writing to spec cache for normalization images in tools/integrations/manage.sh, right @cgardens?

@yaroslav-dudar
Copy link
Contributor Author

@ChristopheDuong please check, is it ok for you 5b3bd3a ?
another point, seems like connector was published but I got error in the end https://github.com/airbytehq/airbyte/runs/3677499341?check_suite_focus=true#step:10:12179
is it possible that my changes are the reason of that issue??

Yes, it seemed to have publish fine!

Can you check that published docker image version has your change in it? (not in conflict from a publish from another PR?)

verified, airbyte/normalization:0.1.45 includes my changes

@yaroslav-dudar
Copy link
Contributor Author

@ChristopheDuong please notify me if I can merge it

@ChristopheDuong
Copy link
Contributor

Yes, if it's published, you're all good to merge, go ahead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Snowflake destination normalization to accept any date-time format.
7 participants