fivetran / dbt_ad_reporting

Fivetran's ad reporting dbt package. Combine your Facebook, Google, Pinterest, LinkedIn, Twitter, Snapchat, Microsoft, TikTok, Reddit, Amazon, and Apple Search advertising metrics using this package.
https://fivetran.github.io/dbt_ad_reporting/#!/overview
Apache License 2.0
146 stars 55 forks source link

[Bug] ad_reporting 1.2.0 does not work on dbt 1.4.1 #78

Closed Igor-Kuzenkov closed 1 year ago

Igor-Kuzenkov commented 1 year ago

Is there an existing issue for this?

Describe the issue

Recently dbt-core was upgraded to 1.4.1 and plugin dbt-snowflake to 1.4.0. After this upgrade ad_reporting 1.2.0 does not work.

Relevant error log or model output

1) dbt deps log (top lines only):
| 07:31:50  Running with dbt=1.4.1
| 07:31:56  Installing fivetran/ad_reporting
| 07:31:57    Installed from version 1.2.0
| 07:31:57    Up to date!
| 07:31:57  Installing fivetran/apple_search_ads
| 07:31:58    Installed from version 0.2.0
| 07:31:58    Up to date!
| 07:31:58  Installing fivetran/snapchat_ads
...

dbt deps works fine. Above is just FYI.

2) dbt run error log:

| 07:32:15  Running with dbt=1.4.1
| 07:32:16  Unable to do partial parsing because saved manifest not found. Starting full parse.
| 07:32:22  [WARNING]: Deprecated functionality
| 
| dbt-core v1.3 renamed attributes for metrics:
|   'sql'              -> 'expression'
|   'type'             -> 'calculation_method'
|   'type: expression' -> 'calculation_method: derived'
| Please remove them from the metric definition of metric 'cost_per_click'
| Relevant issue here: https://github.com/dbt-labs/dbt-core/issues/5849
| 07:32:25  Encountered an error:
| 'False and True' is not of type 'boolean'
|
| Failed validating 'type' in schema['properties']['enabled']:
|     {'default': True, 'type': 'boolean'}
|
| On instance['enabled']:
|     'False and True'
| 07:32:25  jsonschema.exceptions.ValidationError: 'False and True' is not of type 'boolean'
|
| Failed validating 'type' in schema['properties']['enabled']:
|     {'default': True, 'type': 'boolean'}
|
| On instance['enabled']:
|     'False and True'
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
|   File "/usr/local/lib/python3.10/dist-packages/dbt/main.py", line 135, in main
|     results, succeeded = handle_and_check(args)
|   File "/usr/local/lib/python3.10/dist-packages/dbt/main.py", line 198, in handle_and_check
|     task, res = run_from_args(parsed)
|   File "/usr/local/lib/python3.10/dist-packages/dbt/main.py", line 245, in run_from_args
|     results = task.run()
|   File "/usr/local/lib/python3.10/dist-packages/dbt/task/runnable.py", line 454, in run
|     self._runtime_initialize()
|   File "/usr/local/lib/python3.10/dist-packages/dbt/task/runnable.py", line 165, in _runtime_initialize
|     super()._runtime_initialize()
|   File "/usr/local/lib/python3.10/dist-packages/dbt/task/runnable.py", line 94, in _runtime_initialize
|     self.load_manifest()
|   File "/usr/local/lib/python3.10/dist-packages/dbt/task/runnable.py", line 81, in load_manifest
|     self.manifest = ManifestLoader.get_full_manifest(self.config)
|   File "/usr/local/lib/python3.10/dist-packages/dbt/parser/manifest.py", line 203, in get_full_manifest
|     manifest = loader.load()
|     patcher.construct_sources()
|   File "/usr/local/lib/python3.10/dist-packages/dbt/parser/sources.py", line 84, in construct_sources
|     parsed = self.parse_source(patched)
|   File "/usr/local/lib/python3.10/dist-packages/dbt/parser/sources.py", line 145, in parse_source
|     config = config.finalize_and_validate()
|   File "/usr/local/lib/python3.10/dist-packages/dbt/contracts/graph/model_config.py", line 353, in finalize_and_validate
|     self.validate(dct)
|   File "/usr/local/lib/python3.10/dist-packages/hologram/__init__.py", line 989, in validate
|     raise ValidationError.create_from(error) from error
| hologram.ValidationError: 'False and True' is not of type 'boolean'
|
| Failed validating 'type' in schema['properties']['enabled']:
|     {'default': True, 'type': 'boolean'}
|
| On instance['enabled']:
|     'False and True'

Expected behavior

ad_reporting package 1.2.0 works correctly with dbt-core 1.4.1 and dbt-snowflake 1.4.0.

dbt Project configurations

In my case four ads systems are enabled:

vars:
  ad_reporting__amazon_ads_enabled:       False
  ad_reporting__apple_search_ads_enabled: False
  ad_reporting__pinterest_ads_enabled:    True
  ad_reporting__microsoft_ads_enabled:    False
  ad_reporting__linkedin_ads_enabled:     False
  ad_reporting__google_ads_enabled:       True
  ad_reporting__twitter_ads_enabled:      False
  ad_reporting__facebook_ads_enabled:     True
  ad_reporting__snapchat_ads_enabled:     False
  ad_reporting__tiktok_ads_enabled:       True

No other specific settings.

Package versions

packages:
  - package: fivetran/ad_reporting
    version: [">=1.2.0"]

What database are you using dbt with?

snowflake

dbt Version

Core:
  - installed: 1.4.1
  - latest:    1.4.1 - Up to date!

Plugins:
  - snowflake: 1.4.0 - Up to date!

Additional Context

The same ad_reporting package version 1.2.0 worked fine with dbt-core version 1.3.2 and dbt-snowflake plugin 1.3.0.

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

fivetran-joemarkiewicz commented 1 year ago

Hi @Igor-Kuzenkov thanks so much for raising this with our team.

I am looking into this to understand what may have been incorporated in the latest version of dbt-core that is not compatible with our package configuration. I will post back once I discover more.

fivetran-joemarkiewicz commented 1 year ago

@Igor-Kuzenkov I was able to find the root of the issue! It turns out there was a way we structured the yaml for an enable config in the recent release of Amazon Ads that did not cooperate with the latest version of dbt-core.

Fortunately, it is a simple fix and should be able to be addressed in the above Amazon Ads #5 PR. I am having my team review and will work to get this rolled out shortly.

Thanks again for raising this to our team!

fivetran-joemarkiewicz commented 1 year ago

@Igor-Kuzenkov this issue was just addressed in the latest release of the Amazon Ads package and should be resolved now. Feel free to run another dbt deps and run to see the issue resolved.

As such, I will close out this bug report. Please feel free to reopen it if you still see the issue. Thanks again for your timely report of this issue. It helped us quickly address the bug for users on the latest version of dbt. 😄

Igor-Kuzenkov commented 1 year ago

Magic happened. Working well now. Thank you, @fivetran-joemarkiewicz, for the quick fix!