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

Source file: remove nested properties #14535

Conversation

davydov-d
Copy link
Collaborator

@davydov-d davydov-d commented Jul 8, 2022

What

File source generates invalid schema for JSON format - it contains an excessive empty properties layer

How

Remove redundant layer

Before

{
"streams": [
  {
    "stream": {
      "name": "us_p0_json_18",
      "json_schema": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "type": "object",
          "$schema": "http://json-schema.org/schema#",
          "required": [
            "data",
            "meta"
          ],
          "properties": {
            "data": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": [
                    "integer",
                    "null",
                    "string"
                  ]
                }
              }
            },
            "meta": {
              "type": "object",
              "required": [
                "view"
              ],
              "properties": {
                "view": {
                  "type": "object",
                  "required": [
                    "approvals",
                    "assetType",
                    "attribution",
                    "attributionLink",
                    "averageRating",~
                   ...

After

{
"streams": [
  {
    "stream": {
      "name": "us_p0_json_18",
      "json_schema": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-07/schema#",
        "required": [
            "data",
            "meta"
        ],
        "properties": {
            "data": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": [
                    "integer",
                    "null",
                    "string"
                  ]
                }
              }
            },
            "meta": {
              "type": "object",
              "required": [
                "view"
              ],
              "properties": {
                "view": {
                  "type": "object",
                  "required": [
                    "approvals",
                    "assetType",
                    "attribution",
                    "attributionLink",
                    "averageRating",

@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Jul 8, 2022
@davydov-d
Copy link
Collaborator Author

davydov-d commented Jul 8, 2022

/test connector=connectors/source-file

🕑 connectors/source-file https://github.com/airbytehq/airbyte/actions/runs/2635889687
✅ connectors/source-file https://github.com/airbytehq/airbyte/actions/runs/2635889687
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        77      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/tests/test_incremental.py       121     25    79%
source_acceptance_test/utils/common.py                  80     17    79%
source_acceptance_test/tests/test_core.py              294    106    64%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
------------------------------------------------------------------------
TOTAL                                                  960    246    74%
Name                      Stmts   Miss  Cover
---------------------------------------------
source_file/__init__.py       2      0   100%
source_file/client.py       235     35    85%
source_file/source.py        50     35    30%
---------------------------------------------
TOTAL                       287     70    76%
Name                      Stmts   Miss  Cover
---------------------------------------------
source_file/__init__.py       2      0   100%
source_file/source.py        50     27    46%
source_file/client.py       235    140    40%
---------------------------------------------
TOTAL                       287    167    42%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestIncremental.test_two_sequential_reads because not found in the config
======================== 21 passed, 1 skipped in 25.97s ========================

@davydov-d
Copy link
Collaborator Author

davydov-d commented Jul 12, 2022

/test connector=connectors/source-file

🕑 connectors/source-file https://github.com/airbytehq/airbyte/actions/runs/2655967640
✅ connectors/source-file https://github.com/airbytehq/airbyte/actions/runs/2655967640
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        77      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/tests/test_incremental.py       121     25    79%
source_acceptance_test/utils/common.py                  80     17    79%
source_acceptance_test/tests/test_core.py              294    106    64%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
------------------------------------------------------------------------
TOTAL                                                  960    246    74%
Name                      Stmts   Miss  Cover
---------------------------------------------
source_file/__init__.py       2      0   100%
source_file/client.py       236     36    85%
source_file/source.py        50     35    30%
---------------------------------------------
TOTAL                       288     71    75%
Name                      Stmts   Miss  Cover
---------------------------------------------
source_file/__init__.py       2      0   100%
source_file/source.py        50     27    46%
source_file/client.py       236    141    40%
---------------------------------------------
TOTAL                       288    168    42%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestIncremental.test_two_sequential_reads because not found in the config
======================== 21 passed, 1 skipped in 24.44s ========================

Copy link
Collaborator

@lazebnyi lazebnyi left a comment

Choose a reason for hiding this comment

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

LGTM

@davydov-d
Copy link
Collaborator Author

davydov-d commented Jul 12, 2022

/publish connector=connectors/source-file

🕑 Publishing the following connectors:
connectors/source-file
https://github.com/airbytehq/airbyte/actions/runs/2656117492


Connector Did it publish? Were definitions generated?
connectors/source-file

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

@davydov-d
Copy link
Collaborator Author

davydov-d commented Jul 12, 2022

/publish connector=connectors/source-file

🕑 Publishing the following connectors:
connectors/source-file
https://github.com/airbytehq/airbyte/actions/runs/2656793962


Connector Did it publish? Were definitions generated?
connectors/source-file

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

@davydov-d
Copy link
Collaborator Author

davydov-d commented Jul 12, 2022

/test connector=connectors/source-file

🕑 connectors/source-file https://github.com/airbytehq/airbyte/actions/runs/2658989030
✅ connectors/source-file https://github.com/airbytehq/airbyte/actions/runs/2658989030
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        77      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/tests/test_incremental.py       121     25    79%
source_acceptance_test/utils/common.py                  80     17    79%
source_acceptance_test/tests/test_core.py              294    106    64%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
------------------------------------------------------------------------
TOTAL                                                  960    246    74%
Name                      Stmts   Miss  Cover
---------------------------------------------
source_file/__init__.py       2      0   100%
source_file/client.py       248     37    85%
source_file/source.py        50     35    30%
---------------------------------------------
TOTAL                       300     72    76%
Name                      Stmts   Miss  Cover
---------------------------------------------
source_file/__init__.py       2      0   100%
source_file/source.py        50     27    46%
source_file/client.py       248    151    39%
---------------------------------------------
TOTAL                       300    178    41%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:56: Skipping TestIncremental.test_two_sequential_reads because not found in the config
======================== 21 passed, 1 skipped in 25.40s ========================

@davydov-d
Copy link
Collaborator Author

davydov-d commented Jul 13, 2022

/publish connector=connectors/source-file

🕑 Publishing the following connectors:
connectors/source-file
https://github.com/airbytehq/airbyte/actions/runs/2661921271


Connector Did it publish? Were definitions generated?
connectors/source-file

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

@davydov-d
Copy link
Collaborator Author

davydov-d commented Jul 13, 2022

/publish connector=connectors/source-file

🕑 Publishing the following connectors:
connectors/source-file
https://github.com/airbytehq/airbyte/actions/runs/2661961337


Connector Did it publish? Were definitions generated?
connectors/source-file

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

@davydov-d davydov-d merged commit 2570f9c into master Jul 13, 2022
@davydov-d davydov-d deleted the ddavydov/#13787-source-file-fix-schema-generation-for-json-files branch July 13, 2022 08:29
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets July 13, 2022 08:30 Inactive
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/source/file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source File throwAssertionError: Mismatched number of tables during normalization
3 participants