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

remove field accessible_bidding_strategies #5

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
1 change: 0 additions & 1 deletion tap_google_ads/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"accessible_bidding_strategy",
"ad_group",
"ad_group_ad",
"ad_group_criterion",
"ad_group_audience_view",
"age_range_view",
"bidding_strategy",
Expand Down
121 changes: 2 additions & 119 deletions tap_google_ads/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,13 @@ def sync(self, sdk_client, customer, stream, config, state, query_limit): # pyli
# Assign True if the primary key is composite.
composite_pks = len(self.primary_keys) > 1

# LIMIT clause in the `ad_group_criterion` and `campaign_criterion`(stream which has composite primary keys) may result in the infinite loop.
# LIMIT clause in the `campaign_criterion`(stream which has composite primary keys) may result in the infinite loop.
# For example, the limit is 10. campaign_criterion stream have total 20 records with campaign_id = 1.
# So, in the first call, the tap retrieves 10 records and the next time query would look like the below,
# WHERE campaign_id >= 1
# Now, the tap will again fetch records with campaign_id = 1.
# That's why we should not pass the LIMIT clause in the query of these streams.
limit_not_possible = ["ad_group_criterion", "campaign_criterion"]
limit_not_possible = ["campaign_criterion"]

# Set limit for the stream which supports filter parameter(WHERE clause) and do not belong to limit_not_possible category.
if self.filter_param and stream_name not in limit_not_possible:
Expand Down Expand Up @@ -767,63 +767,6 @@ def sync(self, sdk_client, customer, stream, config, state, query_limit):

def initialize_core_streams(resource_schema):
return {
"accessible_bidding_strategies": BaseStream(
report_definitions.ACCESSIBLE_BIDDING_STRATEGY_FIELDS,
["accessible_bidding_strategy"],
resource_schema,
["id"],
{"customer_id"},
filter_param="accessible_bidding_strategy.id"
),
"accounts": BaseStream(
report_definitions.ACCOUNT_FIELDS,
["customer"],
resource_schema,
["id"],
filter_param="customer.id"
),
"ad_groups": BaseStream(
report_definitions.AD_GROUP_FIELDS,
["ad_group"],
resource_schema,
["id"],
{
"campaign_id",
"customer_id",
},
filter_param="ad_group.id"
),
"ad_group_criterion": BaseStream(
report_definitions.AD_GROUP_CRITERION_FIELDS,
["ad_group_criterion"],
resource_schema,
["ad_group_id","criterion_id"],
{
"campaign_id",
"customer_id",
},
filter_param="ad_group.id"
),
"ads": BaseStream(
report_definitions.AD_GROUP_AD_FIELDS,
["ad_group_ad"],
resource_schema,
["id"],
{
"ad_group_id",
"campaign_id",
"customer_id",
},
filter_param = "ad_group_ad.ad.id"
),
"bidding_strategies": BaseStream(
report_definitions.BIDDING_STRATEGY_FIELDS,
["bidding_strategy"],
resource_schema,
["id"],
{"customer_id"},
filter_param="bidding_strategy.id"
),
"call_details": BaseStream(
report_definitions.CALL_VIEW_FIELDS,
["call_view"],
Expand All @@ -843,14 +786,6 @@ def initialize_core_streams(resource_schema):
{"customer_id"},
filter_param="campaign.id"
),
"campaign_budgets": BaseStream(
report_definitions.CAMPAIGN_BUDGET_FIELDS,
["campaign_budget"],
resource_schema,
["id"],
{"customer_id"},
filter_param="campaign_budget.id"
),
"campaign_criterion": BaseStream(
report_definitions.CAMPAIGN_CRITERION_FIELDS,
["campaign_criterion"],
Expand Down Expand Up @@ -967,65 +902,13 @@ def initialize_core_streams(resource_schema):

def initialize_reports(resource_schema):
return {
"account_performance_report": ReportStream(
report_definitions.ACCOUNT_PERFORMANCE_REPORT_FIELDS,
["customer"],
resource_schema,
["_sdc_record_hash"],
{"customer_id"},
),
"ad_group_audience_performance_report": ReportStream(
report_definitions.AD_GROUP_AUDIENCE_PERFORMANCE_REPORT_FIELDS,
["ad_group_audience_view"],
resource_schema,
["_sdc_record_hash"],
{
"ad_group_criterion_criterion_id",
"ad_group_id",
},
),
"ad_group_performance_report": ReportStream(
report_definitions.AD_GROUP_PERFORMANCE_REPORT_FIELDS,
["ad_group"],
resource_schema,
["_sdc_record_hash"],
{"ad_group_id"},
),
"ad_performance_report": ReportStream(
report_definitions.AD_PERFORMANCE_REPORT_FIELDS,
["ad_group_ad"],
resource_schema,
["_sdc_record_hash"],
{"id"},
),
"age_range_performance_report": ReportStream(
report_definitions.AGE_RANGE_PERFORMANCE_REPORT_FIELDS,
["age_range_view"],
resource_schema,
["_sdc_record_hash"],
{
"ad_group_criterion_age_range",
"ad_group_criterion_criterion_id",
"ad_group_id",
},
),
"campaign_performance_report": ReportStream(
report_definitions.CAMPAIGN_PERFORMANCE_REPORT_FIELDS,
["campaign"],
resource_schema,
["_sdc_record_hash"],
{"campaign_id"},
),
"campaign_audience_performance_report": ReportStream(
report_definitions.CAMPAIGN_AUDIENCE_PERFORMANCE_REPORT_FIELDS,
["campaign_audience_view"],
resource_schema,
["_sdc_record_hash"],
{
"campaign_id",
"campaign_criterion_criterion_id",
},
),
"click_performance_report": ReportStream(
report_definitions.CLICK_PERFORMANCE_REPORT_FIELDS,
["click_view"],
Expand Down
23 changes: 0 additions & 23 deletions tap_google_ads/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ def expected_metadata(self):

return {
# Core Objects
"Accounts": {
self.PRIMARY_KEYS: {"TODO"},
self.REPLICATION_METHOD: self.FULL,
},
"Campaigns": {
self.PRIMARY_KEYS: {"TODO"},
self.REPLICATION_METHOD: self.FULL,
Expand All @@ -72,31 +68,12 @@ def expected_metadata(self):
self.PRIMARY_KEYS: {"TODO"},
self.REPLICATION_METHOD: self.FULL,
},
"Ads": {
self.PRIMARY_KEYS: {"TODO"},
self.REPLICATION_METHOD: self.FULL,
},
# Standard Reports
"ACCOUNT_PERFORMANCE_REPORT": {
self.PRIMARY_KEYS: {"TODO"},
self.REPLICATION_METHOD: self.INCREMENTAL,
self.REPLICATION_KEYS: {"date"},
},
"ADGROUP_PERFORMANCE_REPORT": {
self.PRIMARY_KEYS: {"TODO"},
self.REPLICATION_METHOD: self.INCREMENTAL,
self.REPLICATION_KEYS: {"date"},
},
"AD_PERFORMANCE_REPORT": {
self.PRIMARY_KEYS: {"TODO"},
self.REPLICATION_METHOD: self.INCREMENTAL,
self.REPLICATION_KEYS: {"date"},
},
"AGE_RANGE_PERFORMANCE_REPORT": {
self.PRIMARY_KEYS: {"TODO"},
self.REPLICATION_METHOD: self.INCREMENTAL,
self.REPLICATION_KEYS: {"date"},
},
"AUDIENCE_PERFORMANCE_REPORT": {
self.PRIMARY_KEYS: {"TODO"},
self.REPLICATION_METHOD: self.INCREMENTAL,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading