Skip to content

Feat: Add destroy command to remove entire project resources#4328

Merged
themisvaltinos merged 3 commits intomainfrom
themis/destroy
May 9, 2025
Merged

Feat: Add destroy command to remove entire project resources#4328
themisvaltinos merged 3 commits intomainfrom
themis/destroy

Conversation

@themisvaltinos
Copy link
Contributor

This update introduces the sqlmesh destroy command, which permanently deletes all engine-managed objects, including warehouse data, the associated state tables and cached SQLMesh assets, effectively resetting the entire project, fixes: #3684

Usage: sqlmesh destroy

This might be useful for cleaning up development projects, proof-of-concept work or pre-production phases with temporary setups.

⚠️ This is destructive and irreversible, and it removes both development and the production environment, so it should only be used when a full removal is necessary.

@themisvaltinos themisvaltinos requested review from a team, erindru and treysp May 7, 2025 15:41
@python_api_analytics
def invalidate_environment(self, name: str, sync: bool = False) -> None:
def invalidate_environment(
self, name: str, sync: bool = False, protect_prod: t.Optional[bool] = True
Copy link
Member

@izeigerman izeigerman May 7, 2025

Choose a reason for hiding this comment

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

I don't think this should be in the public API of the context. If you want to reuse the method I suggest having a shared private method instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes good point actually only the invalidate method is used from it too so no need to call this

)

def invalidate_environment(self, name: str) -> None:
def invalidate_environment(self, name: str, protect_prod: t.Optional[bool] = True) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

ditto: why the new argument is optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right my bad no need for it

Copy link
Contributor

@georgesittas georgesittas left a comment

Choose a reason for hiding this comment

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

LGTM, just one question related to backup tables.

name: The name of the environment to invalidate.
sync: If True, the call blocks until the environment is deleted. Otherwise, the environment will
be deleted asynchronously by the janitor process.
protect_prod: If True, prevents invalidation of the production environment.
Copy link
Contributor

Choose a reason for hiding this comment

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

Outdated comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch! thanks

@themisvaltinos themisvaltinos merged commit 5b2fa5b into main May 9, 2025
23 checks passed
@themisvaltinos themisvaltinos deleted the themis/destroy branch May 9, 2025 16:13
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.

Add command to reset/remove entire project

3 participants