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

Fix add_ephemeral_prefix to identifier instead of name #10550

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

aranke
Copy link
Member

@aranke aranke commented Aug 9, 2024

Problem

Functional tests for "dbt unit testing" are failing on database errors like so:

  An error occurred during execution of unit test 'test_my_model_version_ref'. There may be an error in the unit test definition: check the data types.
   Database Error
    relation "__dbt__cte__my_model_v2" does not exist
    LINE 21: ) select * from __dbt__cte__my_model_v2

This is related to this PR merged yesterday: dbt-labs/dbt-adapters#236

Solution

Pass in cte_model.identifier instead of cte_model.name to add_ephemeral_prefix.

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@cla-bot cla-bot bot added the cla:yes label Aug 9, 2024
Copy link
Contributor

github-actions bot commented Aug 9, 2024

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@aranke aranke added the Skip Changelog Skips GHA to check for changelog file label Aug 9, 2024
Copy link

codecov bot commented Aug 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.87%. Comparing base (3d09872) to head (83ce993).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10550      +/-   ##
==========================================
- Coverage   88.90%   88.87%   -0.04%     
==========================================
  Files         180      180              
  Lines       22721    22721              
==========================================
- Hits        20200    20193       -7     
- Misses       2521     2528       +7     
Flag Coverage Δ
integration 86.10% <100.00%> (-0.04%) ⬇️
unit 62.35% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Unit Tests 62.35% <0.00%> (ø)
Integration Tests 86.10% <100.00%> (-0.04%) ⬇️

@aranke aranke marked this pull request as ready for review August 9, 2024 18:57
@aranke aranke requested a review from a team as a code owner August 9, 2024 18:57
@aranke aranke requested a review from MichelleArk August 9, 2024 18:57
@@ -375,7 +375,7 @@ def _recursively_prepend_ctes(

_extend_prepended_ctes(prepended_ctes, new_prepended_ctes)

new_cte_name = self.add_ephemeral_prefix(cte_model.name)
new_cte_name = self.add_ephemeral_prefix(cte_model.identifier)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ops, Community contribution with test here

Copy link
Contributor

@MichelleArk MichelleArk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done!

@aranke aranke merged commit 47848b8 into main Aug 9, 2024
76 of 79 checks passed
@aranke aranke deleted the fix_add_ephemeral_prefix branch August 9, 2024 18:58
github-actions bot pushed a commit that referenced this pull request Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.8.latest cla:yes Skip Changelog Skips GHA to check for changelog file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants