Skip to content
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

[BUG] Save test history fails when a model and a source have the same name with a dependency between them #371

Open
akshaykarle opened this issue Nov 2, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@akshaykarle
Copy link

Describe the bug
When re_data:save_test_history is enabled, dbt test command fails with the following error:

�[0m18:47:39  Running 1 on-run-end hook
�[0m18:47:39  Database error while running on-run-end
�[0m18:47:39  Encountered an error:
Compilation Error in operation re_data-on-run-end-0 (./dbt_project.yml)
  'None' has no attribute 'database'

  > in macro default__save_test_history_impl (macros/run_end/save_results_history.sql)
  > called by macro save_test_history (macros/run_end/save_results_history.sql)
  > called by macro test_data_dict (macros/run_end/save_results_history.sql)
  > called by operation re_data-on-run-end-0 (./dbt_project.yml)

Expected behavior
dbt test should complete without any errors and does so when re_data:save_test_history is false.

To Reproduce
Steps to reproduce the behavior:

  1. Create a source and a model with the same name say foobar.
  2. Add tests that adds a dependency between the 2. eg- calculates say dbt_utils.equal_rowcount between ref('foobar') and use source('hello', 'foobar') as the compare_model.
  3. Set re_data:save_test_history to true and run dbt test.

Screenshots
NA

Logs and additional context
NA

@akshaykarle akshaykarle added the bug Something isn't working label Nov 2, 2022
akshaykarle added a commit to akshaykarle/dbt-re-data that referenced this issue Nov 2, 2022
…with the same name

* Without checking the node_type, a model could match a source with the same name and the macro would error out trying to get the database on that node which is not present for a source
* Fixes issue: re-data/re-data#371
akshaykarle added a commit to akshaykarle/dbt-re-data that referenced this issue Nov 2, 2022
…with the same name

* Without checking the node_type, a model could match a source with the same name and the macro would error out trying to get the database on that node which is not present for a source
* Fixes issue: re-data/re-data#371
akshaykarle added a commit to akshaykarle/dbt-re-data that referenced this issue Nov 2, 2022
…with the same name

* Without checking the node_type, a model could match a source with the same name and the macro would error out trying to get the database on that node which is not present for a source
* Fixes issue: re-data/re-data#371
@akshaykarle
Copy link
Author

re-data/dbt-re-data#106 should fix this. is someone able to review and merge it? it has been open for a while now.

akshaykarle added a commit to akshaykarle/dbt-re-data that referenced this issue Jun 21, 2023
…with the same name

* Without checking the node_type, a model could match a source with the same name and the macro would error out trying to get the database on that node which is not present for a source
* Fixes issue: re-data/re-data#371
akshaykarle added a commit to akshaykarle/dbt-re-data that referenced this issue Jun 21, 2023
…with the same name

* Without checking the node_type, a model could match a source with the same name and the macro would error out trying to get the database on that node which is not present for a source
* Fixes issue: re-data/re-data#371
cmardiros pushed a commit to cmardiros/dbt-re-data that referenced this issue Jun 21, 2023
…with the same name

* Without checking the node_type, a model could match a source with the same name and the macro would error out trying to get the database on that node which is not present for a source
* Fixes issue: re-data/re-data#371
cmardiros pushed a commit to cmardiros/dbt-re-data that referenced this issue Jun 21, 2023
…with the same name

* Without checking the node_type, a model could match a source with the same name and the macro would error out trying to get the database on that node which is not present for a source
* Fixes issue: re-data/re-data#371
akshaykarle added a commit to akshaykarle/dbt-re-data that referenced this issue Jun 21, 2023
…with the same name

* Without checking the node_type, a model could match a source with the same name and the macro would error out trying to get the database on that node which is not present for a source
* Fixes issue: re-data/re-data#371
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant