Skip to content

Commit a776ed1

Browse files
make message closer to the original
1 parent c02f93b commit a776ed1

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
@@ -1297,23 +1297,12 @@ def start_destroy(
12971297
views_to_delete: t.Optional[t.Set[str]] = None,
12981298
tables_to_delete: t.Optional[t.Set[str]] = None,
12991299
) -> bool:
1300-
self.log_error(
1301-
(
1302-
"!!! EXTREME CAUTION: DESTRUCTIVE OPERATION !!!\n\n"
1303-
"The 'destroy' command will DELETE:\n"
1304-
" • ALL state tables and metadata\n"
1305-
" • ALL SQLMesh cache and build artifacts\n"
1306-
" • ALL tables and views in the project's schemas/datasets\n"
1307-
" • ALL schemas/datasets managed by SQLMesh in this project\n\n"
1308-
"!!! WARNING: This includes external tables created or managed by other tools !!!\n\n"
1309-
"The operation may disrupt any currently running or scheduled plans.\n"
1310-
"Only use this command when you intend to COMPLETELY DESTROY the project.\n"
1311-
)
1300+
self.log_warning(
1301+
"This will permanently delete all engine-managed objects, state tables and SQLMesh cache.\n"
1302+
"The operation may disrupt any currently running or scheduled plans.\n"
13121303
)
13131304

1314-
# Display what will be deleted
13151305
if schemas_to_delete or views_to_delete or tables_to_delete:
1316-
self.log_error("\n" + "=" * 50 + "\n")
13171306
if schemas_to_delete:
13181307
self.log_error("Schemas to be deleted:")
13191308
for schema in sorted(schemas_to_delete):
@@ -1329,18 +1318,12 @@ def start_destroy(
13291318
for table in sorted(tables_to_delete):
13301319
self.log_error(f" • {table}")
13311320

1332-
self.log_error("\nAll SQLMesh state tables will be deleted")
1333-
self.log_error("\n" + "=" * 50 + "\n")
1334-
1335-
# Final confirmation with stronger warning
13361321
self.log_error(
1337-
"!!! WARNING: This action will DELETE ALL the above resources managed by SQLMesh\n"
1338-
"AND potentially external resources created by other tools in these schemas !!!\n"
1322+
"\nThis action will DELETE ALL the above resources managed by SQLMesh AND\n"
1323+
"potentially external resources created by other tools in these schemas.\n"
13391324
)
13401325

1341-
if not self._confirm(
1342-
"Do you understand the risks and are you ABSOLUTELY SURE you want to proceed with deletion?"
1343-
):
1326+
if not self._confirm("Are you ABSOLUTELY SURE you want to proceed with deletion?"):
13441327
self.log_error("Destroy operation cancelled.")
13451328
return False
13461329
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)