fivetran / dbt_facebook_pages

Fivetran data models for Facebook Pages built using dbt.
https://fivetran.github.io/dbt_facebook_pages/
Apache License 2.0
2 stars 4 forks source link

[Bug] `actions_post_reactions_total` field always null #8

Closed zhyatt closed 1 year ago

zhyatt commented 1 year ago

Is there an existing issue for this?

Describe the issue

The actions_post_reactions_total field is always null, regardless of how many actions of the various types exist (anger, haha, like, etc.)

Relevant error log or model output

No response

Expected behavior

The actions_post_reactions_total field should be a sum of the total actions of every type. Given this is more of an aggregation of some data, perhaps this doesn't belong in this package after all and should be removed altogether. Although it could be an upstream issue, see Additional Context below for more detail.

dbt Project configurations

Just the standard ones to get the facebook_pages_source package working

Package versions

v0.2.0

What database are you using dbt with?

bigquery

dbt Version

dbt v1.3.1

Additional Context

When using the Fivetran Facebook Pages connector to ingest the data, the daily_page_metrics_total source table doesn't appear to have the column page_actions_post_reactions_total (which is what this package is ultimately trying to read it seems) but instead only has the individual type totals:

page_actions_post_reactions_anger_total page_actions_post_reactions_haha_total page_actions_post_reactions_like_total page_actions_post_reactions_love_total page_actions_post_reactions_sorry_total

There is a chance the package isn't wrong in assuming this field should be there and instead the issue is with the upstream connector not populating a field that it should be.

Are you willing to open a PR to help address this issue?

zhyatt commented 1 year ago

I just realized I put this in the wrong package. It should be in the https://github.com/fivetran/dbt_facebook_pages_source repository. Are you able to move this Issue over there? If not I can reproduce there in the correct spot.

fivetran-joemarkiewicz commented 1 year ago

Hi @zhyatt thanks for opening this issue and no worries that it is in this repo.

I did some quick digging and wanted to highlight that we don't actually perform any transformations on this field. In fact, in the staging model we are only renaming it. See here for the snippet where we renamed the field. Likewise, in the end model, we only reference that field from the staging model (seen here).

You do make a great observation though that the individual reaction type totals being populated seems accurate and is strange that the total field is not. This may be something we can address within the package. However, I would first want to understand why the total field is not being populated in the source data. For the time being, I would recommend opening a support ticket for our support and engineering teams to investigate the data being synced by the connector.

Additionally, I noticed you mentioned you would be open to creating a PR to address this issue. My thought would be to perform something similar to the following in the staging model:

        page_actions_post_reactions_anger_total as actions_post_reactions_anger_total,
        page_actions_post_reactions_haha_total as actions_post_reactions_haha_total,
        page_actions_post_reactions_like_total as actions_post_reactions_like_total,
        page_actions_post_reactions_love_total as actions_post_reactions_love_total,
        page_actions_post_reactions_sorry_total as actions_post_reactions_sorry_total,
        coalesce(page_actions_post_reactions_total,(page_actions_post_reactions_anger_total + page_actions_post_reactions_haha_total + page_actions_post_reactions_like_total + page_actions_post_reactions_love_total + page_actions_post_reactions_sorry_total)) as actions_post_reactions_total,

This would ensure we are totally the reactions manually if the total from the source is showing as null. We could pursue this in a PR for the package in the interim. However, I would still encourage you to open a support ticket as this is something I don't believe should not be showing as null in the source data. Let me know if you have any questions!

zhyatt commented 1 year ago

@fivetran-joemarkiewicz Thanks for responding, I opened a support ticket per your request and will report back the results.

fivetran-joemarkiewicz commented 1 year ago

Hi @zhyatt I just got confirmation that the actions_post_reactions_total was in fact removed from the connector. As such, we will want to move forward with applying the updates proposed to the dbt package.

I see you are interested in opening a PR. If you are still in fact open to contributing, I would be happy to review your PR with these proposed changes. Otherwise, my team can work on this update in our upcoming sprint. Let me know!

fivetran-joemarkiewicz commented 1 year ago

@zhyatt thank you again for your help in addressing this issue! The latest release will include your changes and the original issue identified here should be addressed.

As such, I will close this issue.