fivetran / dbt_zendesk

Fivetran's Zendesk Support dbt package
https://fivetran.github.io/dbt_zendesk/#!/overview
Apache License 2.0
26 stars 30 forks source link

BUG - Package compilation does not respect the `using_organization_tags` field #41

Closed pblankley closed 3 years ago

pblankley commented 3 years ago

Are you a current Fivetran customer? Consultant working with Designs for Health

Describe the bug When setting the using_organization_tags variable to False I get the following compilation error:

Running with dbt=0.20.1
Encountered an error:
Compilation Error in model int_zendesk__organization_aggregates (models/intermediate/int_zendesk__organization_aggregates.sql)
  Model 'model.zendesk.int_zendesk__organization_aggregates' (models/intermediate/int_zendesk__organization_aggregates.sql) depends on a node named 'stg_zendesk__organization_tag' which is disabled

Looking at your source code, this may be a dbt issue because it looks like the reference is contained inside of an if statement.

Steps to reproduce

  1. Download this package and dependencies version 0.6.0 with dbt 0.20.1
  2. Set using_organization_tags: False in dbt_project.yml
  3. Run dbt run
  4. See error

Expected behavior I expect you'll see this error

Running with dbt=0.20.1
Encountered an error:
Compilation Error in model int_zendesk__organization_aggregates (models/intermediate/int_zendesk__organization_aggregates.sql)
  Model 'model.zendesk.int_zendesk__organization_aggregates' (models/intermediate/int_zendesk__organization_aggregates.sql) depends on a node named 'stg_zendesk__organization_tag' which is disabled

Project variables configuration

name: 'XXXXXXX'
version: '1.0.0'
config-version: 2

profile: 'XXXXXXX'

source-paths: ["models"]
analysis-paths: ["analysis"]
test-paths: ["tests"]
data-paths: ["data"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

target-path: "target"  # directory which will store compiled SQL files
clean-targets:         # directories to be removed by `dbt clean`
    - "target"
    - "dbt_modules"

vars:
  zendesk_source:
    zendesk_database: designs_for_health
    zendesk_schema: dfhzendesk
    using_organization_tags: False

Package Version

packages:
  - package: fivetran/zendesk
    version: [">=0.6.0", "<0.7.0"]

Warehouse

- [ ] BigQuery - [ ] Redshift - [x] Snowflake - [ ] Postgres - [ ] Databricks - [ ] Other (provide details below) **Additional context** **Screenshots**

Please indicate the level of urgency If this doesn't work we'll use something else for Zendesk transformation.

Are you interested in contributing to this package?

fivetran-joemarkiewicz commented 3 years ago

Hi @pblankley thanks for opening this issue.

It looks like you are setting the variable within the source package variable configuration, but this configuration is also needed within the transform model (which is why you see the error occurring within the intermediate int_zendesk__organization_aggregates model.

You can resolve this error by either setting the using_organization_tags variable globally or within both the source and transform package. You can leverage either of the below configs:

vars:
  zendesk_database: designs_for_health
  zendesk_schema: dfhzendesk
  using_organization_tags: False

or

vars:
  zendesk_source:
    zendesk_database: designs_for_health
    zendesk_schema: dfhzendesk
    using_organization_tags: False
  zendesk:
    zendesk_database: designs_for_health
    zendesk_schema: dfhzendesk
    using_organization_tags: False

I tested your config locally and received the same error message and saw it resolved with either of the two above configs. Let me know if this ends up working or does not work for you. Thanks!

pblankley commented 3 years ago

This worked perfectly! Thanks for the great write up @fivetran-joemarkiewicz 🙌