-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
馃帀 Source Salesforce: Add the ability to filter streams (#8871)
* Source Salesforce: Add the ability to filter streams (version 0.1.11) * Source Salesforce: fix examples for new field in specification (version 0.1.12)
- Loading branch information
1 parent
4501ad0
commit ea578e8
Showing
11 changed files
with
151 additions
and
40 deletions.
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
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