-
Notifications
You must be signed in to change notification settings - Fork 23
TDL-16008 add new search types #39
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
Conversation
CHANGELOG.md
Outdated
@@ -1,5 +1,8 @@ | |||
# Changelog | |||
|
|||
## 1.0.0 | |||
* Add support for new search types news, googleNews, discover [#39](https://github.com/singer-io/tap-google-search-console/pull/39) |
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.
Can we also list (as another point here) that we're major version changing for general release?
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.
Added
@@ -89,7 +89,7 @@ class IncrementalTableStream(BaseStream, ABC): | |||
forced_replication_method = "INCREMENTAL" | |||
replication_key = "date" | |||
pagination = "body" | |||
sub_types = ["web", "image", "video"] | |||
sub_types = ["web", "image", "video", "news", "googleNews", "discover"] |
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.
any reason not to alphabetize these for long-term maintainability? If there's not a specific reason, I think we should given that it's used in multiple places in performance_reports as well
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.
Done
# Excluding discover sub_type since Requests for Discover cannot be grouped by device. | ||
# this also overwrites the sub_types attribute declared for class IncrementalTableStream | ||
# in abstract.py | ||
sub_types = ["web", "image", "video", "news", "googleNews"] |
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.
same as previous sub_types comment
# grouping data for discover and googleNews | ||
# this also overwrites the sub_types attribute declared for class IncrementalTableStream | ||
# in abstract.py | ||
sub_types = ["web", "image", "video", "news"] |
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.
same as previous sub_types comment
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.
Done
# Skip the extraction for type discover | ||
# Requests for Discover cannot be grouped by device | ||
if sub_type == "discover" and "device" in self.body_params["dimensions"]: | ||
self.body_params["dimensions"].remove("device") |
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.
This comment is confusing. We remove device and don't appear to skip extraction of discover type; is there something I'm missing? Is there documentation that shows discovery can't be grouped by device, and if so, can we add that to the relevant Jira or the code comment?
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.
my bad, updated the comment. I couldn't find any documentation on webmasters but these exceptions were found while testing. I have seen few issues reported on stackoverflow for the same
# Skip the extraction for type discover | ||
# Requests for Discover cannot be grouped by device | ||
if sub_type == "discover" and "device" in self.body_params["dimensions"]: | ||
self.body_params["dimensions"].remove("device") |
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.
Is this removing a selected field for the purpose of the request? If so, I think we should at a minimum write a log line that indicates that we're doing this.
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.
This isn't removing the selected field. So, for custom reports we consider all the dimensions(page, country, device, query, date) where as for performance_report_device
we consider only device
as dimension.
If user selects the device field in performance_report_custom
and while replicating data for discover sub_type
we end up encountering the error Requests for Discover cannot be grouped by device
, to avoid this we simple remove device
dimension from dimensions_list for discover sub_type. and this dimension_list is passed as param in API request
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.
this is very similar to not considering discover sub_type for performance_report_device stream here
Description of change
This PR adds support for new search type
news
,googleNews
anddiscover
docI thought this is quite simple to add these search_types by appending them to sub_types attribute defined in abstract.py but there are few exceptions for below streams:
discover
search_type since Requests for Discover cannot be grouped by devicediscover
andgoogleNews
search_types since Query is an invalid argument while grouping data for discover and googleNewsdiscover
andgoogleNews
search_types when user selectsdiscover
andquery
fields for this stream. So, these are being filtered out during making payload for this stream.Note: This change will be released as major release because of two reasons
Manual QA steps
Risks
Rollback steps