Skip to content

Commit 5378280

Browse files
feat(cli): add 'feast projects delete' command (issue feast-dev#5095)
Exposes project deletion via the CLI. The new `feast projects delete <name>` command calls `store._registry.delete_project()` which is already implemented in all concrete registries. Adds an interactive confirmation prompt that can be bypassed with --yes/-y for scripted workflows.
1 parent 9107a43 commit 5378280

1 file changed

Lines changed: 42 additions & 6 deletions

File tree

‎sdk/python/feast/cli/projects.py‎

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
@click.group(name="projects")
1111
def projects_cmd():
1212
"""
13-
Access projects
13+
Access and manage projects
1414
"""
15-
pass
1615

1716

1817
@projects_cmd.command("describe")
@@ -27,8 +26,8 @@ def project_describe(ctx: click.Context, name: str):
2726
try:
2827
project = store.get_project(name)
2928
except FeastObjectNotFoundException as e:
30-
print(e)
31-
exit(1)
29+
print(str(e))
30+
raise SystemExit(1)
3231

3332
print(
3433
yaml.dump(
@@ -58,7 +57,7 @@ def project_current(ctx: click.Context):
5857
)
5958

6059

61-
@projects_cmd.command(name="list")
60+
@projects_cmd.command("list")
6261
@tagsOption
6362
@click.pass_context
6463
def project_list(ctx: click.Context, tags: list[str]):
@@ -75,6 +74,43 @@ def project_list(ctx: click.Context, tags: list[str]):
7574

7675
print(
7776
tabulate(
78-
table, headers=["NAME", "DESCRIPTION", "TAGS", "OWNER"], tablefmt="plain"
77+
table,
78+
headers=["NAME", "DESCRIPTION", "TAGS", "OWNER"],
79+
tablefmt="plain",
7980
)
8081
)
82+
83+
84+
@projects_cmd.command("delete")
85+
@click.argument("name", type=click.STRING)
86+
@click.option(
87+
"--yes",
88+
"-y",
89+
is_flag=True,
90+
help="Skip confirmation prompt and delete immediately.",
91+
)
92+
@click.pass_context
93+
def project_delete(ctx: click.Context, name: str, yes: bool):
94+
"""
95+
Delete a project and all its resources from the registry.
96+
97+
This removes the project entry from the registry. Individual objects
98+
(feature views, entities, data sources) that belong to the project
99+
are also purged when commit=True (the default).
100+
"""
101+
store = create_feature_store(ctx)
102+
103+
if not yes:
104+
click.confirm(
105+
f"Are you sure you want to delete project '{name}'? "
106+
"This will remove all associated resources from the registry.",
107+
abort=True,
108+
)
109+
110+
try:
111+
store._registry.delete_project(name, commit=True)
112+
except FeastObjectNotFoundException as e:
113+
print(str(e))
114+
raise SystemExit(1)
115+
116+
print(f"Project '{name}' deleted successfully.")

0 commit comments

Comments
 (0)