Transformations: salesforce formula utils with snowflake in dbt not working as expected
CompletedConsider 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
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:
- package: fivetran/salesforce_formula_utils
version: [">=0.7.0", "<0.8.0"]
What database are you using dbt with?
snowflake
dbt Version
1.2
https://github.com/fivetran/dbt_salesforce_formula_utils/issues/62 - for reference
-
Official comment
We now include the database name in the references!
-
I think the correct behaviour should be a DBT jinja like this example:
FROM {{ source('salesforce', 'asset') }} AS asset__table
Then DBT should do the right thing when generating the query.
-
Nothing on this yet?
-
Hi all,
We are looking into adding the database name to the sql model so that references are fully qualified in the fivetran_formula_model table. Look forward to an update on this thread once it ships!
Please sign in to leave a comment.
Comments
4 comments