-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dbt_utils.get_column_values and dbt_utils.star macros are not working when database in profiles.yml file is differennt from the database in the src.yml file #729
Comments
@IrinaSel those macros are just abstractions over native dbt Core functionality, and I think they're working as expected! I don't actually know what the I think that instead you'd be well-served by doing something like this: sources:
- name: salesforce
schema: salesforce
database: {{ "prod" if target.name == 'prod' else "falcon" }}
tables:
- name: fivetran_formula |
Hey @joellabes! |
Is the user account you used that worked the same as the one that dbt is using? If the dbt user account doesn't have access to the table, it will probably say it doesn't exist as opposed to saying you don't have permission to access it. What are the full names of the prod and staging tables you're trying to access? |
Hey! It's all one table "falcon"."salesforce"."fivetran_formula", but dbt_utils.get_column_values can't select column names taken from field column in "falcon"."salesforce"."fivetran_formula" table. |
The error message you're seeing is caused by this line:
Which happens when
Because of this, I'm back to noting that
You could get a more specific reproduction case by trying to use |
Describe the bug
When database in profiles.yml is not the same as a database parameter in src.yml file dbt_utils.get_column_values fails with compilation error and dbt_utils.star returns * instead of list of columns in Redshift. Discovered this problem when we were trying to split source and production schemas and implement salesforce_fornula_utils package for some staging models.
select * from falcon.salesforce.fivetran_formula is working and returns data
Steps to reproduce
In profiles.yml file
dbname: prod
In src.yml file
When running dbt compile for the
test
model:Expected results
Expect to get select statement with column names taken from field column in salesforce.fivetran_formula table.
Actual results
Runtime Error
Compilation Error in model test (models/staging/salesforce/test.sql)
In get_column_values(): relation "falcon"."salesforce"."fivetran_formula" does not exist and no default value was provided.
System information
packages:
version: 0.8.6
version: 0.5.1
version: 0.8.1
version: 0.4.7
version: [">=0.6.0", "<0.7.0"]
Which database are you using dbt with?
The output of
dbt --version
:Additional context
Found this similar issue, but with Snowflake.
Are you interested in contributing the fix?
no
The text was updated successfully, but these errors were encountered: