Skip to content

Conversation

@xardasos
Copy link
Contributor

@xardasos xardasos commented Nov 17, 2025

This PR optimizes views migration. In the case of metadata changes, it is not always necessary to recreate views if the engine doesn't support view comments. This optimization is especially relevant for materialized views, which can take more time to be rebuilt.

@xardasos
Copy link
Contributor Author

xardasos commented Dec 18, 2025

Hi @izeigerman, @erindru and @eakmanrq, I'd appreciate your review of this PR.

The changes aim to prevent unnecessary view (especially MV) recreation when deploying Metadata snapshots to production on engines that don't support view comments. In previous versions of SQLMesh (before 0.183.0, related to #4414), metadata changes didn't trigger view recreation. This PR aims to restore this behavior while still allowing view recreation in scenarios where it's necessary.

Note: For engines that support comments in post-creation commands (like COMMENT or ALTER), we might be able to avoid recreation and only update the comments. This optimization is not included in this PR. However, it's unlikely to be feasible for engines that only allow comments in CREATE VIEW schema definitions.

I'm open to any suggestions you may have. Thanks for your time!

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.

1 participant