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 Salesforce: Add the ability to filter streams #8871

Merged
merged 7 commits into from
Dec 23, 2021

Conversation

yevhenii-ldv
Copy link
Contributor

@yevhenii-ldv yevhenii-ldv commented Dec 17, 2021

What

resolves #7031.

How

A function has been added to the specification that allows users to specify values for filtering streams, as well as specify the type of option for filtering.
It is Optional field

Recommended reading order

  1. x.java
  2. y.python

Pre-merge Checklist

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

@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Dec 17, 2021
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Dec 17, 2021

/test connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1592551166
❌ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1592551166
🐛 https://gradle.com/s/rpkcfatlt2j2k
Python short test summary info:

=========================== short test summary info ============================
FAILED test_core.py::TestBasicRead::test_read[inputs1] - AssertionError:  Rec...
FAILED test_incremental.py::TestIncremental::test_two_sequential_reads[inputs1]
=================== 2 failed, 19 passed in 373.02s (0:06:13) ===================

@jrhizor jrhizor temporarily deployed to more-secrets December 17, 2021 14:03 Inactive
@yevhenii-ldv yevhenii-ldv temporarily deployed to more-secrets December 17, 2021 14:55 Inactive
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Dec 17, 2021

/test connector=connectors/source-salesforce

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

	 ---------- 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                        76      8    89%
	 source_acceptance_test/conftest.py                     109    109     0%
	 source_acceptance_test/plugin.py                        47     47     0%
	 source_acceptance_test/tests/__init__.py                 4      0   100%
	 source_acceptance_test/tests/test_core.py              242     96    60%
	 source_acceptance_test/tests/test_full_refresh.py       38     27    29%
	 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                  54     24    56%
	 source_acceptance_test/utils/compare.py                 62     25    60%
	 source_acceptance_test/utils/connector_runner.py       101     65    36%
	 source_acceptance_test/utils/json_schema_helper.py     115     14    88%
	 ------------------------------------------------------------------------
	 TOTAL                                                  972    459    53%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                 Stmts   Miss  Cover
	 --------------------------------------------------------
	 source_salesforce/__init__.py            2      0   100%
	 source_salesforce/api.py               120     63    48%
	 source_salesforce/exceptions.py          1      0   100%
	 source_salesforce/rate_limiting.py      22      6    73%
	 source_salesforce/source.py             57     24    58%
	 source_salesforce/streams.py           214     38    82%
	 source_salesforce/utils.py               8      7    12%
	 --------------------------------------------------------
	 TOTAL                                  424    138    67%

@jrhizor jrhizor temporarily deployed to more-secrets December 17, 2021 15:04 Inactive
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Dec 20, 2021

/test connector=connectors/source-salesforce

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

	 ---------- 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                        76      8    89%
	 source_acceptance_test/conftest.py                     109    109     0%
	 source_acceptance_test/plugin.py                        47     47     0%
	 source_acceptance_test/tests/__init__.py                 4      0   100%
	 source_acceptance_test/tests/test_core.py              242     96    60%
	 source_acceptance_test/tests/test_full_refresh.py       38     27    29%
	 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                  54     24    56%
	 source_acceptance_test/utils/compare.py                 62     25    60%
	 source_acceptance_test/utils/connector_runner.py       101     65    36%
	 source_acceptance_test/utils/json_schema_helper.py     115     14    88%
	 ------------------------------------------------------------------------
	 TOTAL                                                  972    459    53%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                 Stmts   Miss  Cover
	 --------------------------------------------------------
	 source_salesforce/__init__.py            2      0   100%
	 source_salesforce/api.py               115     43    63%
	 source_salesforce/exceptions.py          1      0   100%
	 source_salesforce/rate_limiting.py      22      6    73%
	 source_salesforce/source.py             57     24    58%
	 source_salesforce/streams.py           214     38    82%
	 source_salesforce/utils.py               8      0   100%
	 --------------------------------------------------------
	 TOTAL                                  419    111    74%

@yevhenii-ldv yevhenii-ldv temporarily deployed to more-secrets December 20, 2021 11:57 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets December 20, 2021 11:57 Inactive
Copy link
Contributor

@htrueman htrueman left a comment

Choose a reason for hiding this comment

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

LGTM. Have just one question for unit tests.

sf_object.instance_url = "https://fase-account.salesforce.com"
sf_object.describe = Mock(return_value={"sobjects": [{"name": f"FakeStream{i}"} for i in range(100)]})
filtered_streams = sf_object.get_validated_streams(config=updated_config)
assert len(filtered_streams) == number_of_filtered_streams
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps we may check the steams by name instead of just count them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is, you propose to use the same method to filter the names of streams, and in the end compare them with each other, it is strange?
Could you tell us in more detail how you see this implementation?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just suggest to compare filtered_stream == expected_filtered_streams.
E.g. ['stream1', 'stream2'] == ['stream1']
Is it possible?

@yevhenii-ldv yevhenii-ldv temporarily deployed to more-secrets December 23, 2021 10:54 Inactive
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Dec 23, 2021

/publish connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1615342856
✅ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1615342856

@jrhizor jrhizor temporarily deployed to more-secrets December 23, 2021 11:24 Inactive
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Dec 23, 2021

/publish connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1615397742
✅ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1615397742

@yevhenii-ldv yevhenii-ldv temporarily deployed to more-secrets December 23, 2021 11:41 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets December 23, 2021 11:42 Inactive
@yevhenii-ldv yevhenii-ldv merged commit ea578e8 into master Dec 23, 2021
@yevhenii-ldv yevhenii-ldv deleted the ykurochkin/add-filter-params-for-schemas branch December 23, 2021 11:54
@yevhenii-ldv yevhenii-ldv temporarily deployed to more-secrets December 23, 2021 11:55 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Salesforce: investigate selecting schemas/streams before the discovery step
4 participants