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

Fix(Source-Facebook-Marketing): Update breakdown schema for BaseInsightStream #55760

Merged

Conversation

agarctfi
Copy link
Contributor

What

Solves: https://github.com/airbytehq/oncall/issues/7624

How

Added missing schema & unit tests to ensure all breakdowns are added

Review guide

Check schema datatypes. One doubt I have is whether we should leave them all as Strings in this context or have the actual datatype for the schema recorded. I'm not too sure since this is used in the configuration of an array of Strings, but I'm not sure if it is used elsewhere.

User Impact

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

@agarctfi agarctfi requested a review from a team as a code owner March 13, 2025 23:06
Copy link

vercel bot commented Mar 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2025 3:08pm

@agarctfi agarctfi changed the title Fix(Source-Facebook-Marketing): Update breakdown schema for Fix(Source-Facebook-Marketing): Update breakdown schema for BaseInsightStream Mar 13, 2025
@agarctfi
Copy link
Contributor Author

agarctfi commented Mar 13, 2025

/format-fix

Format-fix job started... Check job output.

✅ Changes applied successfully. (1cfa4fe)

Copy link
Contributor

@brianjlai brianjlai left a comment

Choose a reason for hiding this comment

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

makes sense overall! just question about how we found the list of properties to add

@@ -163,6 +167,126 @@
"video_name": { "type": ["null", "string"] },
"id": { "type": ["null", "string"] }
}
},
"breakdown_reporting_ad_id": {
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't know salesforce all too well, but where were some of these types generated from?

I see things like mmm and fidelity_type are found in:

from facebook_business.adobjects.adsinsights import AdsInsights
AdsInsights.Breakdowns.__dict__

but some of these aren't in that dictionary so I'm curious where those came from. Also it would help me validate that the types are correct if I can compare them against FBCA

Copy link
Contributor Author

@agarctfi agarctfi Mar 19, 2025

Choose a reason for hiding this comment

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

These come from the facebok_business library.

class Breakdowns:
        ad_format_asset = 'ad_format_asset'
        age = 'age'
        app_id = 'app_id'
        body_asset = 'body_asset'
        breakdown_reporting_ad_id = 'breakdown_reporting_ad_id'
        call_to_action_asset = 'call_to_action_asset'
        coarse_conversion_value = 'coarse_conversion_value'
        conversion_destination = 'conversion_destination'
        country = 'country'
        description_asset = 'description_asset'
        device_platform = 'device_platform'
        dma = 'dma'
        fidelity_type = 'fidelity_type'
        frequency_value = 'frequency_value'
        gender = 'gender'
        hourly_stats_aggregated_by_advertiser_time_zone = 'hourly_stats_aggregated_by_advertiser_time_zone'
        hourly_stats_aggregated_by_audience_time_zone = 'hourly_stats_aggregated_by_audience_time_zone'
        hsid = 'hsid'
        image_asset = 'image_asset'
        impression_device = 'impression_device'
        is_conversion_id_modeled = 'is_conversion_id_modeled'
        is_rendered_as_delayed_skip_ad = 'is_rendered_as_delayed_skip_ad'
        landing_destination = 'landing_destination'
        link_url_asset = 'link_url_asset'
        marketing_messages_btn_name = 'marketing_messages_btn_name'
        mdsa_landing_destination = 'mdsa_landing_destination'
        media_asset_url = 'media_asset_url'
        media_creator = 'media_creator'
        media_destination_url = 'media_destination_url'
        media_format = 'media_format'
        media_origin_url = 'media_origin_url'
        media_text_content = 'media_text_content'
        media_type = 'media_type'
        mmm = 'mmm'
        place_page_id = 'place_page_id'
        platform_position = 'platform_position'
        postback_sequence_index = 'postback_sequence_index'
        product_id = 'product_id'
        publisher_platform = 'publisher_platform'
        redownload = 'redownload'
        region = 'region'
        signal_source_bucket = 'signal_source_bucket'
        skan_campaign_id = 'skan_campaign_id'
        skan_conversion_id = 'skan_conversion_id'
        skan_version = 'skan_version'
        sot_attribution_model_type = 'sot_attribution_model_type'
        sot_attribution_window = 'sot_attribution_window'
        sot_channel = 'sot_channel'
        sot_event_type = 'sot_event_type'
        sot_source = 'sot_source'
        standard_event_content_type = 'standard_event_content_type'
        title_asset = 'title_asset'
        user_persona_id = 'user_persona_id'
        user_persona_name = 'user_persona_name'
        video_asset = 'video_asset'

They are tested here, and are defined here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@agarctfi ah yeah okay, my bad, I was reviewing locally and I had not updated facebook's python dependencies in a while so I was looking at my Breakdown list from an older version which was missing some of the new ones.

One last question here, I noticed you pulled the id fields from existing fields into separate body_asset_id, call_to_action_asset_id, description_asset_id. Was there a bug or functional reason for doing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@brianjlai, I think those were already there, and not too sure what their functional reasons are. I ran a script I made to alphabetize the schema, which moved some around, but the final output should be what was already included in the schema prior, and whatever was missing from this is the Breakdowns class.

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, maybe my wording was confusing, but in the Breakdowns list above there is no body_asset_id. but in the schema now I see:

 "body_asset_id": {
   "description": "The ID of the main content or message of the ad.",
   "type": ["null", "string"]
 },

And so we have 3 extra fields that are prefixed with _id and I wasn't sure why we needed those when there is already an existing: body_asset, call_to_action_asset and description_asset already in the schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it! I can remove them; I was just saying that they were already there (in master); I think maybe they are outdated Breakdowns of older versions of the facebok_business library.

Well, after searching, though, I didn't see that facebook_marketing even used these fields, but we do use them here:

object_breakdowns = {
"body_asset": "body_asset_id",
"call_to_action_asset": "call_to_action_asset_id",
"description_asset": "description_asset_id",
"image_asset": "image_asset_id",
"link_url_asset": "link_url_asset_id",
"title_asset": "title_asset_id",
"video_asset": "video_asset_id",
}

From this PR, to solve this issue.

I think this here gives some real insight and seems to be something we did intentionally to avoid breaking changes, but it seems like it was already done previously (old code), so we left it then. So it may be best to leave it, but I would love to hear your input on it @brianjlai

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah i agree, i think my curiosity is getting the better of me and maybe it's best not to go further down the rabbit hole. and agree on not making this breaking. Maybe we have some use for it maybe we don't but I'm leaving as is. thanks for investigating further. I'm good to merge this

@agarctfi
Copy link
Contributor Author

agarctfi commented Mar 19, 2025

/format-fix

Format-fix job started... Check job output.

✅ Changes applied successfully. (5bb5dd4)

Copy link
Contributor

@brianjlai brianjlai left a comment

Choose a reason for hiding this comment

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

approving, but are you able to get a regression test run before the merge?

@agarctfi
Copy link
Contributor Author

Regressions timeout, but I ran manually on my cloud env via dev image, and they look good.

We also pinned the user, and it did resolve the issue for them!

@agarctfi
Copy link
Contributor Author

agarctfi commented Mar 21, 2025

/approve-regression-tests

Check job output.

✅ Approving regression tests

@agarctfi agarctfi merged commit 05cf22d into master Mar 21, 2025
31 of 32 checks passed
@agarctfi agarctfi deleted the agarctfi/source-facebook-marketing/baseInsightsSchemaFix branch March 21, 2025 14:20
Valgard pushed a commit to mayflower/airbyte that referenced this pull request Mar 25, 2025
…ghtStream` (airbytehq#55760)

Co-authored-by: Octavia Squidington III <[email protected]>
Co-authored-by: Natik Gadzhi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants