fivetran / dbt_salesforce_formula_utils

Package containing dbt macros to help generate salesforce formula fields synced from Fivetran.
https://fivetran.github.io/dbt_salesforce_formula_utils/
Apache License 2.0
16 stars 18 forks source link

full_statement_version=true does not produce fully qualified table names, required for Snowflake #62

Closed jeff-skoldberg closed 1 year ago

jeff-skoldberg commented 1 year ago

Is there an existing issue for this?

Describe the issue

Consider a source.yml like this:

  - name: salesforce
    database: fivetran
    schema: my_fivetran_salesforce_schema
    tables:
      - name: my_salesforce_table
      - name: fivetran_formula_model
      - name: fivetran_formula

And a connection in dbt Cloud with a default database of my_default_database

Then I have a model, call it my_salesforce_table_with_formulas.sql, which contains this code: {{ salesforce_formula_utils.sfdc_formula_view(source_table='my_salesforce_table', full_statement_version=true) }}

When I compile the SQL, I will find a FROM clause that contains a table that is not fully qualified:

from
my_fivetran_salesforce_schema.my_salesforce_table

When I try to preview the model or dbt run I will get this error: SQL compilation error: Schema 'MY_DEFAULT_DATABASE.MY_FIVETRAN_SALESFORCE_SCHEMA' does not exist or not authorized. (I'm on Snowflake, so upper case names)

It should of course by looking for fivetran.my_fivetran_salesforce_schema

Relevant error log or model output

No response

Expected behavior

The sql produced by the macro should be fully qualified with db name. In this example:

from
fivetran.my_fivetran_salesforce_schema.my_salesforce_table

dbt Project configurations

relevant config is in description of file.

Package versions

packages:

What database are you using dbt with?

snowflake

dbt Version

1.2

Additional Context

No response

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

fivetran-joemarkiewicz commented 1 year ago

Hi @jeff-skoldberg thanks for opening this issue. Unfortunately, as described within this dbt Slack thread this change would require a change on the connector side. The support ticket you opened will be where further communication will take place.

As such, I will close this issue.

jeff-skoldberg commented 1 year ago

Thanks as always, @fivetran-joemarkiewicz