Skip to content

Conversation

@koletzilla
Copy link
Contributor

@koletzilla koletzilla commented Oct 3, 2025

Summary

A situation that we didn't controlled in #516. Related to #507

  1. Model with materialization: view is created with hackers name
  2. Model with materialization: materializaed_view is created with hackers_mv name.
  • Take into account that in this case 2 resources are created: a CH table named hackers_mv and a CH MV called hackers_mv_mv
  1. Refresh view hackers -> Error is raised because the code is trying to drop the view hackers_mv but that's a table. if it were a view, we would have been removing it :(

The Error came on the new code we added to drop the MVs:

  • The code that internally looks for MVs pointing to hackers works ok: it doesn't find MVs.
  • The issue is that when we call clickhouse__drop_mvs macro, it just tries to remove any _mv thing available, even if it doesn't make sense

Changes:

  • Created a new clickhouse__drop_mvs_with_names macro and send to it the filtered list of names to drop so now it doesn't include already filtered ones.

Copy link
Contributor

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

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

Looks good to me 🤙

💡 To request another review, post a new comment with "/windsurf-review".

@koletzilla koletzilla force-pushed the ClickHouse/fix-error-if-mv-exists-and-view-is-not-named-as-mv branch from 11eb2da to 51e6225 Compare October 6, 2025 15:21
@koletzilla koletzilla merged commit 902c2a8 into main Oct 8, 2025
17 checks passed
@koletzilla koletzilla deleted the ClickHouse/fix-error-if-mv-exists-and-view-is-not-named-as-mv branch October 8, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants