Skip to content

Commit 2672d1f

Browse files
make message closer to the original
1 parent ee82545 commit 2672d1f

File tree

2 files changed

+10
-42
lines changed

2 files changed

+10
-42
lines changed

sqlmesh/core/console.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,23 +1303,12 @@ def start_destroy(
13031303
views_to_delete: t.Optional[t.Set[str]] = None,
13041304
tables_to_delete: t.Optional[t.Set[str]] = None,
13051305
) -> bool:
1306-
self.log_error(
1307-
(
1308-
"!!! EXTREME CAUTION: DESTRUCTIVE OPERATION !!!\n\n"
1309-
"The 'destroy' command will DELETE:\n"
1310-
" • ALL state tables and metadata\n"
1311-
" • ALL SQLMesh cache and build artifacts\n"
1312-
" • ALL tables and views in the project's schemas/datasets\n"
1313-
" • ALL schemas/datasets managed by SQLMesh in this project\n\n"
1314-
"!!! WARNING: This includes external tables created or managed by other tools !!!\n\n"
1315-
"The operation may disrupt any currently running or scheduled plans.\n"
1316-
"Only use this command when you intend to COMPLETELY DESTROY the project.\n"
1317-
)
1306+
self.log_warning(
1307+
"This will permanently delete all engine-managed objects, state tables and SQLMesh cache.\n"
1308+
"The operation may disrupt any currently running or scheduled plans.\n"
13181309
)
13191310

1320-
# Display what will be deleted
13211311
if schemas_to_delete or views_to_delete or tables_to_delete:
1322-
self.log_error("\n" + "=" * 50 + "\n")
13231312
if schemas_to_delete:
13241313
self.log_error("Schemas to be deleted:")
13251314
for schema in sorted(schemas_to_delete):
@@ -1335,18 +1324,12 @@ def start_destroy(
13351324
for table in sorted(tables_to_delete):
13361325
self.log_error(f" • {table}")
13371326

1338-
self.log_error("\nAll SQLMesh state tables will be deleted")
1339-
self.log_error("\n" + "=" * 50 + "\n")
1340-
1341-
# Final confirmation with stronger warning
13421327
self.log_error(
1343-
"!!! WARNING: This action will DELETE ALL the above resources managed by SQLMesh\n"
1344-
"AND potentially external resources created by other tools in these schemas !!!\n"
1328+
"\nThis action will DELETE ALL the above resources managed by SQLMesh AND\n"
1329+
"potentially external resources created by other tools in these schemas.\n"
13451330
)
13461331

1347-
if not self._confirm(
1348-
"Do you understand the risks and are you ABSOLUTELY SURE you want to proceed with deletion?"
1349-
):
1332+
if not self._confirm("Are you ABSOLUTELY SURE you want to proceed with deletion?"):
13501333
self.log_error("Destroy operation cancelled.")
13511334
return False
13521335
return True

tests/integrations/jupyter/test_magics.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -898,27 +898,12 @@ def test_destroy(
898898
assert not output.stderr
899899
text_output = convert_all_html_output_to_text(output)
900900
expected_messages = [
901-
(
902-
"!!! EXTREME CAUTION: DESTRUCTIVE OPERATION !!!\n\n"
903-
"The 'destroy' command will DELETE:\n"
904-
" • ALL state tables and metadata\n"
905-
" • ALL SQLMesh cache and build artifacts\n"
906-
" • ALL tables and views in the project's schemas/datasets\n"
907-
" • ALL schemas/datasets managed by SQLMesh in this project\n\n"
908-
"!!! WARNING: This includes external tables created or managed by other tools !!!\n\n"
909-
"The operation may disrupt any currently running or scheduled plans.\n"
910-
"Only use this command when you intend to COMPLETELY DESTROY the project."
911-
),
901+
"[WARNING] This will permanently delete all engine-managed objects, state tables and SQLMesh cache.\nThe operation may disrupt any currently running or scheduled plans.",
912902
"Schemas to be deleted:",
913903
"• memory.sushi",
914904
"Snapshot tables to be deleted:",
915-
"All SQLMesh state tables will be deleted",
916-
"==================================================",
917-
(
918-
"!!! WARNING: This action will DELETE ALL the above resources managed by SQLMesh\n"
919-
"AND potentially external resources created by other tools in these schemas !!!"
920-
),
921-
"Do you understand the risks and are you ABSOLUTELY SURE you want to proceed with deletion? [y/n]:",
905+
"This action will DELETE ALL the above resources managed by SQLMesh AND\npotentially external resources created by other tools in these schemas.",
906+
"Are you ABSOLUTELY SURE you want to proceed with deletion? [y/n]:",
922907
"Environment 'prod' invalidated.",
923908
"Deleted object memory.sushi",
924909
'Deleted object "memory"."raw"."model1"',
@@ -927,4 +912,4 @@ def test_destroy(
927912
"Destroy completed successfully.",
928913
]
929914
for message in expected_messages:
930-
assert message in text_output
915+
assert any(message in line for line in text_output)

0 commit comments

Comments
 (0)