-
Notifications
You must be signed in to change notification settings - Fork 207
Feat: Add destroy command to remove entire project resources #4328
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
base: main
Are you sure you want to change the base?
Conversation
87164cc
to
1997df6
Compare
sqlmesh/core/context.py
Outdated
@@ -1516,16 +1529,19 @@ def apply( | |||
) | |||
|
|||
@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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
@@ -108,14 +108,15 @@ def update_environment_statements( | |||
columns_to_types=self._environment_statements_columns_to_types, | |||
) | |||
|
|||
def invalidate_environment(self, name: str) -> None: | |||
def invalidate_environment(self, name: str, protect_prod: t.Optional[bool] = True) -> None: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
1997df6
to
822a85f
Compare
There was a problem hiding this 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.
sqlmesh/core/context.py
Outdated
@@ -1523,6 +1536,7 @@ def invalidate_environment(self, name: str, sync: bool = False) -> None: | |||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! thanks
822a85f
to
c0e81b9
Compare
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: #3684Usage:
sqlmesh destroy
This might be useful for cleaning up development projects, proof-of-concept work or pre-production phases with temporary setups.