Skip to content

Commit

Permalink
#12650 source GAds to GA: doc review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davydov-d committed May 13, 2022
1 parent 747ffde commit 08ee0dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/integrations/sources/google-ads.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ You'll also need to find these values. See the [setup guide](#setup-guide) for i

This guide will provide information as if starting from scratch. Please skip over any steps you have already completed.

1. Create a Google Ads Account. Here are [Google's instruction](https://support.google.com/google-ads/answer/6366720) on how to create one.
2. Create a Google Ads MANAGER Account. Here are [Google's instruction](https://ads.google.com/home/tools/manager-accounts/) on how to create one.
1. Create a Google Ads Account. Here are [Google's instructions](https://support.google.com/google-ads/answer/6366720) on how to create one.
2. Create a Google Ads MANAGER Account. Here are [Google's instructions](https://ads.google.com/home/tools/manager-accounts/) on how to create one.
3. You should now have two Google Ads accounts: a normal account and a manager account. Link the Manager account to the normal account following [Google's documentation](https://support.google.com/google-ads/answer/7459601).
4. Select your `customer_id`. The `customer_id` refers to the id of each of your Google Ads accounts. This is the 10 digit number in the top corner of the page when you are in Google Ads UI. The source will only pull data from the accounts for which you provide an id. If you are having trouble finding it, check out [Google's instructions](https://support.google.com/google-ads/answer/1704344).

Expand Down Expand Up @@ -106,7 +106,7 @@ Note that `ad_groups`, `ad_group_ads`, and `campaigns` contain a `labels` field,

**Note**: Due to constraints from the Google Ads API, [metrics](https://developers.google.com/google-ads/api/fields/v9/metrics) cannot be requested for a manager account. Therefore, report streams are only available when pulling data from a non-manager account.

**Note**: For incremental streams data is synced up to the previous day using your Google Ads account time zone. The reason is that Google Ads can filter data only by [date](https://developers.google.com/google-ads/api/fields/v9/ad_group_ad#segments.date) without time. Also, some report cannot load data in real time due to Google Ads [limitations](https://support.google.com/google-ads/answer/2544985?hl=en).
**Note**: For incremental streams data is synced up to the previous day using your Google Ads account time zone. The reason is that Google Ads can filter data only by [date](https://developers.google.com/google-ads/api/fields/v9/ad_group_ad#segments.date) without time. Also, some reports cannot load data in real time due to Google Ads [limitations](https://support.google.com/google-ads/answer/2544985?hl=en).

## Understanding Google Ads Query Language

Expand Down

1 comment on commit 08ee0dc

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

SonarQube Report

SonarQube report for Airbyte Connectors Source Google Ads(#12807)

Measures

Name Value Name Value Name Value
Code Smells 90 Bugs 0 Security Rating A
Vulnerabilities 0 Duplicated Blocks 0 Quality Gate Status OK
Lines to Cover 363 Coverage 90.6 Lines of Code 535
Duplicated Lines (%) 0.0 Reliability Rating A Blocker Issues 0
Critical Issues 2 Major Issues 4 Minor Issues 84

Detected Issues

Rule File Description Message
python:mypy_valid_type (MINOR) source_google_ads/streams.py:51 Check that type (annotation) is valid Function "builtins.any" is not valid as a type . Code line: ) -> Iterable[Optional[Mapping[str, any]]]:
python:mypy_attr_defined (MINOR) source_google_ads/source.py:14 Check that attribute exists Module "pendulum" does not explicitly export attribute "parse"; implicit reexport disabled . Code line: from pendulum import parse, timezone, today
python:S1192 (CRITICAL) source_google_ads/streams.py:112 String literals should not be duplicated Define a constant instead of duplicating this literal "segments.date" 6 times.
python:mypy_assignment (MINOR) source_google_ads/streams.py:340 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "List[str]", base class "IncrementalGoogleAdsStream" defined the type as "None") . Code line: primary_key = ["click_view.gclid", "segments.date", "segments.ad_n...
python:mypy_valid_type (MINOR) source_google_ads/source.py:53 Check that type (annotation) is valid Function "pendulum.tz.timezone" is not valid as a type . Code line: ... GoogleAds, config: Mapping[str, Any], tz: Union[timezone, str] = "loc...
python:mypy_return (MINOR) source_google_ads/source.py:67 Check that function always returns a value Missing return statement . Code line: def get_account_info(self, google_api: GoogleAds, config: Mapping[...
python:mypy_assignment (MINOR) source_google_ads/streams.py:227 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "List[str]", base class "IncrementalGoogleAdsStream" defined the type as "None") . Code line: primary_key = ["customer.id", "segments.date"]
python:mypy_assignment (MINOR) source_google_ads/streams.py:235 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "List[str]", base class "IncrementalGoogleAdsStream" defined the type as "None") . Code line: primary_key = ["campaign.id", "segments.date"]
python:mypy_assignment (MINOR) source_google_ads/streams.py:252 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "List[str]", base class "IncrementalGoogleAdsStream" defined the type as "None") . Code line: primary_key = ["ad_group.id", "segments.date"]
python:mypy_assignment (MINOR) source_google_ads/streams.py:269 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "List[str]", base class "IncrementalGoogleAdsStream" defined the type as "None") . Code line: primary_key = ["ad_group_ad.ad.id", "segments.date"]
python:mypy_index (MINOR) source_google_ads/google_ads.py:40 Check indexing operations Unsupported target for indexed assignment ("Mapping[str, Any]") . Code line: credentials["use_proto_plus"] = True
python:mypy_no_any_return (MINOR) source_google_ads/source.py:71 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Dict[Any, Any]" . Code line: return next(accounts_streams.read_records(sync_mode=SyncMo...
python:mypy_call_overload (MINOR) source_google_ads/source.py:71 Check that an overload variant matches arguments No overload variant of "next" matches argument types "Iterable[Mapping[str, Any]]", "Dict[, ]" . Code line: return next(accounts_streams.read_records(sync_mode=SyncMo...
python:mypy_valid_type (MINOR) source_google_ads/streams.py:97 Check that type (annotation) is valid Function "builtins.any" is not valid as a type . Code line: ...[str, Any] = None, **kwargs) -> Iterable[Optional[Mapping[str, any]]]:
python:mypy_assignment (MINOR) source_google_ads/streams.py:99 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "str", variable has type "None") . Code line: self._customer_id = customer_id
python:mypy_arg_type (MINOR) source_google_ads/streams.py:105 Check argument types in calls Argument "customer_id" to "send_request" of "GoogleAds" has incompatible type "None"; expected "str" . Code line: ...d_request(self.get_query(stream_slice), customer_id=self._customer_id)
python:mypy_assignment (MINOR) source_google_ads/streams.py:127 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "str", variable has type "None") . Code line: self._customer_id = customer_id
python:S3776 (CRITICAL) source_google_ads/streams.py:151 Cognitive Complexity of functions should not be too high Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
python:mypy_index (MINOR) source_google_ads/streams.py:177 Check indexing operations Value of type "Optional[Mapping[str, Any]]" is not indexable . Code line: ...self._customer_id, {}).get(self.cursor_field) == stream_slice["start_d...
python:mypy_call_overload (MINOR) source_google_ads/streams.py:177 Check that an overload variant matches arguments No overload variant of "get" of "Mapping" matches argument types "None", "Dict[, ]" . Code line: elif state.get(self._customer_id, {}).get(self.cur...
python:mypy_index (MINOR) source_google_ads/streams.py:183 Check indexing operations Unsupported target for indexed assignment ("Optional[Mapping[str, Any]]") . Code line: stream_slice["start_date"] = state.get(self._custo...
python:mypy_call_overload (MINOR) source_google_ads/streams.py:183 Check that an overload variant matches arguments No overload variant of "get" of "Mapping" matches argument types "None", "Dict[, ]" . Code line: stream_slice["start_date"] = state.get(self._custo...
python:mypy_index (MINOR) source_google_ads/streams.py:183 Check indexing operations Value of type "Optional[Mapping[str, Any]]" is not indexable . Code line: ...et(self._customer_id, {}).get(self.cursor_field, stream_slice["start_d...
python:mypy_call_overload (MINOR) source_google_ads/streams.py:196 Check that an overload variant matches arguments No overload variant of "get" of "Mapping" matches argument type "None" . Code line: elif current_stream_state.get(self._customer_id) and current_s...
python:mypy_index (MINOR) source_google_ads/streams.py:196 Check indexing operations Invalid index type "None" for "MutableMapping[str, Any]"; expected type "str" . Code line: ....get(self._customer_id) and current_stream_state[self._customer_id].ge...
python:mypy_index (MINOR) source_google_ads/streams.py:197 Check indexing operations Invalid index type "None" for "MutableMapping[str, Any]"; expected type "str" . Code line: stream_state = current_stream_state[self._customer_id][sel...
python:mypy_dict_item (MINOR) source_google_ads/streams.py:199 Check dict items in a dict expression {key: value, ...} Dict entry 0 has incompatible type "None": "Dict[Any, Any]"; expected "str": "Any" . Code line: current_stream_state.update({self._customer_id: {self.curs...
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:202 Check that attribute exists Module has no attribute "parse" . Code line: date_in_current_stream = pendulum.parse(stream_state)
python:mypy_dict_item (MINOR) source_google_ads/streams.py:206 Check dict items in a dict expression {key: value, ...} Dict entry 0 has incompatible type "None": "Dict[Any, Any]"; expected "str": "Any" . Code line: {self._customer_id: {self.cursor_field: (max(date_in_curre...
python:mypy_union_attr (MINOR) source_google_ads/custom_query_stream.py:33 Check that attribute exists in each item of a union Item "None" of "Optional[Mapping[str, Any]]" has no attribute "get" . Code line: start_date, end_date = stream_slice.get("start_date"), stream_...
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:32 Check that attribute exists Module has no attribute "parse" . Code line: start_date = pendulum.parse(start_date)
python:mypy_operator (MINOR) source_google_ads/streams.py:33 Check that operator is valid for operands Unsupported operand types for > ("str" and "DateTime") . Code line: if start_date > pendulum.now():
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:34 Check that attribute exists "str" has no attribute "to_date_string" . Code line: return start_date.to_date_string(), start_date.add(days=1).to_...
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:34 Check that attribute exists "str" has no attribute "add" . Code line: return start_date.to_date_string(), start_date.add(days=1).to_...
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:35 Check that attribute exists "str" has no attribute "add" . Code line: end_date = min(end_date, start_date.add(days=range_days))
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:38 Check that attribute exists "str" has no attribute "add" . Code line: if start_date.add(days=1).date() >= end_date.date():
python:mypy_union_attr (MINOR) source_google_ads/streams.py:38 Check that attribute exists in each item of a union Item pendulum.datetime? of "Optional[pendulum.datetime?]" has no attribute "date" . Code line: if start_date.add(days=1).date() >= end_date.date():
python:mypy_union_attr (MINOR) source_google_ads/streams.py:38 Check that attribute exists in each item of a union Item "None" of "Optional[pendulum.datetime?]" has no attribute "date" . Code line: if start_date.add(days=1).date() >= end_date.date():
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:39 Check that attribute exists "str" has no attribute "add" . Code line: return start_date.add(days=1).to_date_string(), start_date.add...
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:40 Check that attribute exists "str" has no attribute "add" . Code line: return start_date.add(days=1).to_date_string(), end_date.to_date_s...
python:mypy_union_attr (MINOR) source_google_ads/streams.py:40 Check that attribute exists in each item of a union Item pendulum.datetime? of "Optional[pendulum.datetime?]" has no attribute "to_date_string" . Code line: ... return start_date.add(days=1).to_date_string(), end_date.to_date_stri...
python:mypy_union_attr (MINOR) source_google_ads/streams.py:40 Check that attribute exists in each item of a union Item "None" of "Optional[pendulum.datetime?]" has no attribute "to_date_string" . Code line: ... return start_date.add(days=1).to_date_string(), end_date.to_date_stri...
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:73 Check that attribute exists "str" has no attribute "to_date_string" . Code line: start, end = get_date_params(start_date.to_date_string(), time...
python:mypy_override (MINOR) source_google_ads/streams.py:151 Check that method override is compatible with base class Signature of "read_records" incompatible with supertype "GoogleAdsStream" . Code line: def read_records(
python:mypy_arg_type (MINOR) source_google_ads/streams.py:167 Check argument types in calls Argument 1 to "get_updated_state" of "IncrementalGoogleAdsStream" has incompatible type "Mapping[str, Any]"; expected "MutableMapping[str, Any]" . Code line: state = self.get_updated_state(state, record)
python:S1871 (MAJOR) source_google_ads/streams.py:180 Two branches in a conditional structure should not have exactly the same implementation Either merge this branch with the identical one on line "175" or change one of the implementations.
python:mypy_union_attr (MINOR) source_google_ads/streams.py:215 Check that attribute exists in each item of a union Item "None" of "Optional[Mapping[str, Any]]" has no attribute "get" . Code line: from_date=stream_slice.get("start_date"),
python:mypy_union_attr (MINOR) source_google_ads/streams.py:216 Check that attribute exists in each item of a union Item "None" of "Optional[Mapping[str, Any]]" has no attribute "get" . Code line: to_date=stream_slice.get("end_date"),
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:80 Check that attribute exists "str" has no attribute "add" . Code line: start_date = start_date.add(days=range_days)
python:mypy_valid_type (MINOR) source_google_ads/source.py:74 Check that type (annotation) is valid Function "pendulum.tz.timezone" is not valid as a type . Code line: def get_time_zone(account: dict) -> Union[timezone, str]:
python:mypy_attr_defined (MINOR) source_google_ads/google_ads.py:92 Check that attribute exists Module has no attribute "parse" . Code line: end_date_inclusive = "<=" if (pendulum.parse(to_date) - pe...
python:mypy_assignment (MINOR) source_google_ads/streams.py:341 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "int", base class "IncrementalGoogleAdsStream" defined the type as "None") . Code line: days_of_data_storage = 90
python:mypy_override (MINOR) source_google_ads/custom_query_stream.py:19 Check that method override is compatible with base class Signature of "primary_key" incompatible with supertype "IncrementalGoogleAdsStream" . Code line: def primary_key(self) -> str:
python:S125 (MAJOR) source_google_ads/custom_query_stream.py:25 Sections of code should not be commented out Remove this commented out code.
python:S5886 (MAJOR) source_google_ads/custom_query_stream.py:26 Function return types should be consistent with their type hint Return a value of type "str" instead of "NoneType" or update function "primary_key" type hint.
python:mypy_return_value (MINOR) source_google_ads/custom_query_stream.py:26 Check that return value is compatible with signature Incompatible return value type (got "None", expected "str") . Code line: return None
python:mypy_arg_type (MINOR) source_google_ads/custom_query_stream.py:34 Check argument types in calls Argument 2 to "insert_segments_date_expr" of "CustomQuery" has incompatible type "Optional[Any]"; expected "str" . Code line: ...sert_segments_date_expr(self.user_defined_query, start_date, end_date)
python:mypy_arg_type (MINOR) source_google_ads/custom_query_stream.py:34 Check argument types in calls Argument 3 to "insert_segments_date_expr" of "CustomQuery" has incompatible type "Optional[Any]"; expected "str" . Code line: ...sert_segments_date_expr(self.user_defined_query, start_date, end_date)
python:mypy_union_attr (MINOR) source_google_ads/custom_query_stream.py:68 Check that attribute exists in each item of a union Item "None" of "Optional[Any]" has no attribute "data_type" . Code line: google_data_type = str(node.data_type).replace("GoogleAdsF...
python:mypy_union_attr (MINOR) source_google_ads/custom_query_stream.py:70 Check that attribute exists in each item of a union Item "None" of "Optional[Any]" has no attribute "enum_values" . Code line: ... field_value = {"type": "string", "enum": list(node.enum_values)}
python:mypy_union_attr (MINOR) source_google_ads/custom_query_stream.py:76 Check that attribute exists in each item of a union Item "None" of "Optional[Any]" has no attribute "is_repeated" . Code line: if node.is_repeated:
python:mypy_dict_item (MINOR) source_google_ads/custom_query_stream.py:80 Check dict items in a dict expression {key: value, ...} Dict entry 1 has incompatible type "str": "bool"; expected "str": "Sequence[Any]" . Code line: ... field_value = {"type": output_type, "protobuf_message": T...
python:mypy_index (MINOR) source_google_ads/custom_query_stream.py:87 Check indexing operations Unsupported target for indexed assignment ("object") . Code line: local_json_schema["properties"][field] = field_value
python:mypy_assignment (MINOR) source_google_ads/custom_query_stream.py:105 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Union[str, Any]", variable has type "Optional[Match[str]]") . Code line: fields = fields.group(1)
python:mypy_attr_defined (MINOR) source_google_ads/custom_query_stream.py:106 Check that attribute exists "Match[str]" has no attribute "split" . Code line: return [f.strip() for f in fields.split(",")]
python:S112 (MAJOR) source_google_ads/custom_query_stream.py:120 "Exception" and "BaseException" should not be raised Replace this generic exception class with a more specific one.
python:mypy_assignment (MINOR) source_google_ads/custom_query_stream.py:121 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Union[str, Any]", variable has type "Optional[Match[str]]") . Code line: columns = columns.group(1)
python:mypy_operator (MINOR) source_google_ads/custom_query_stream.py:122 Check that operator is valid for operands Unsupported left operand type for + ("Match[str]") . Code line: new_columns = columns + ", segments.date\n"
python:mypy_arg_type (MINOR) source_google_ads/custom_query_stream.py:123 Check argument types in calls Argument 1 to "replace" of "str" has incompatible type "Match[str]"; expected "str" . Code line: result_query = query.replace(columns, new_columns)
python:mypy_assignment (MINOR) source_google_ads/custom_query_stream.py:141 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "str", variable has type "Optional[Match[str]]") . Code line: where_cond = where_cond.group(0)
python:mypy_arg_type (MINOR) source_google_ads/custom_query_stream.py:142 Check argument types in calls Argument 1 to "search" of "Pattern" has incompatible type "Match[str]"; expected "str" . Code line: keywords = CustomQuery.KEYWORDS_EXPR.search(where_cond)
python:mypy_call_overload (MINOR) source_google_ads/custom_query_stream.py:145 Check that an overload variant matches arguments No overload variant of "getitem" of "Match" matches argument type "slice" . Code line: where_cond = where_cond[0 : keywords.start()]
python:mypy_operator (MINOR) source_google_ads/custom_query_stream.py:146 Check that operator is valid for operands Unsupported left operand type for + ("Match[str]") . Code line: new_where_cond = where_cond + f" AND segments.date BETWEEN '{s...
python:mypy_operator (MINOR) source_google_ads/custom_query_stream.py:146 Check that operator is valid for operands Unsupported left operand type for + ("None") . Code line: new_where_cond = where_cond + f" AND segments.date BETWEEN '{s...
python:mypy_arg_type (MINOR) source_google_ads/custom_query_stream.py:147 Check argument types in calls Argument 1 to "replace" of "str" has incompatible type "Optional[Match[str]]"; expected "str" . Code line: result_query = result_query.replace(where_cond, new_where_cond...
python:mypy_union_attr (MINOR) source_google_ads/google_ads.py:79 Check that attribute exists in each item of a union Item "None" of "Optional[Any]" has no attribute "keys" . Code line: return list(properties.keys())
python:mypy_operator (MINOR) source_google_ads/google_ads.py:168 Check that operator is valid for operands Unsupported right operand type for in ("Optional[Any]") . Code line: if "array" in schema_type.get("type"):
python:mypy_valid_type (MINOR) source_google_ads/google_ads.py:179 Check that type (annotation) is valid Item "None" of "Optional[Any]" has no attribute "get" [union-attr] ...{field: GoogleAds.get_field_value(result, field, props.get(field)) for...
python:mypy_no_any_return (MINOR) source_google_ads/source.py:50 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Mapping[str, Any]" . Code line: return credentials
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:58 Check that attribute exists Module has no attribute "parse" . Code line: end_date = pendulum.parse(end_date) if end_date else pendulum.now(...
python:mypy_assignment (MINOR) source_google_ads/streams.py:58 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Union[Any, DateTime]", variable has type "Optional[str]") . Code line: end_date = pendulum.parse(end_date) if end_date else pendulum.now(...
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:59 Check that attribute exists Module has no attribute "parse" . Code line: start_date = pendulum.parse(start_date)
python:mypy_operator (MINOR) source_google_ads/streams.py:66 Check that operator is valid for operands Unsupported operand types for > ("str" and "None") . Code line: if start_date > end_date:
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:70 Check that attribute exists "str" has no attribute "subtract" . Code line: start_date = start_date.subtract(days=conversion_window)
python:mypy_operator (MINOR) source_google_ads/streams.py:72 Check that operator is valid for operands Unsupported operand types for < ("str" and "None") . Code line: while start_date < end_date:
python:mypy_valid_type (MINOR) source_google_ads/streams.py:125 Check that type (annotation) is valid Function "builtins.any" is not valid as a type . Code line: ...[str, Any] = None, **kwargs) -> Iterable[Optional[Mapping[str, any]]]:
python:mypy_attr_defined (MINOR) source_google_ads/streams.py:203 Check that attribute exists Module has no attribute "parse" . Code line: date_in_latest_record = pendulum.parse(latest_record[self.curs...
python:mypy_valid_type (MINOR) source_google_ads/source.py:92 Check that type (annotation) is valid Function "builtins.any" is not valid as a type . Code line: ...logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]:
python:mypy_assignment (MINOR) source_google_ads/google_ads.py:87 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "str", variable has type "List[str]") . Code line: fields = ",\n".join(fields)
python:mypy_no_any_return (MINOR) source_google_ads/google_ads.py:173 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "str" . Code line: return field_value

Coverage (90.6%)

File Coverage File Coverage
source_google_ads/init.py 100.0 source_google_ads/custom_query_stream.py 92.0
source_google_ads/google_ads.py 79.4 source_google_ads/source.py 96.3
source_google_ads/streams.py 92.0

Please sign in to comment.