-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
yevhenii-ldv
merged 7 commits into
master
from
ykurochkin/add-filter-params-for-schemas
Dec 23, 2021
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
404797e
Source Salesforce: Add the ability to filter streams
yevhenii-ldv b3db366
update acceptance-test-config.yml
yevhenii-ldv ec7eecb
add unit_test for new functionality
yevhenii-ldv 620488a
update tests
yevhenii-ldv 1e2093f
merge with master
yevhenii-ldv 2bfea2f
Source Salesforce: fix examples for new field in specification
yevhenii-ldv 2acab0d
bump version
yevhenii-ldv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 1 addition & 22 deletions
23
airbyte-integrations/connectors/source-salesforce/source_salesforce/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
airbyte-integrations/connectors/source-salesforce/source_salesforce/utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# Copyright (c) 2021 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
|
||
def filter_streams(streams_list: list, search_word: str, search_criteria: str): | ||
search_word = search_word.lower() | ||
criteria_mapping = { | ||
"starts with": lambda stream_name: stream_name.startswith(search_word), | ||
"starts not with": lambda stream_name: not stream_name.startswith(search_word), | ||
"ends with": lambda stream_name: stream_name.endswith(search_word), | ||
"ends not with": lambda stream_name: not stream_name.endswith(search_word), | ||
"contains": lambda stream_name: search_word in stream_name, | ||
"not contains": lambda stream_name: search_word not in stream_name, | ||
"exacts": lambda stream_name: search_word == stream_name, | ||
"not exacts": lambda stream_name: search_word != stream_name, | ||
} | ||
new_streams_list = [] | ||
for stream in streams_list: | ||
if criteria_mapping[search_criteria](stream.lower()): | ||
new_streams_list.append(stream) | ||
return new_streams_list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?