FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(cli): Add `feast projects delete` command by mailtoboggavarapu-coder · Pull Request #6302 · feast-dev/feast · GitHub

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
50 changes: 43 additions & 7 deletions sdk/python/feast/cli/projects.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@

from feast import utils
from feast.cli.cli_options import tagsOption
from feast.errors import FeastObjectNotFoundException
from feast.errors import FeastObjectNotFoundException, ProjectNotFoundException
from feast.repo_operations import create_feature_store


@click.group(name="projects")
def projects_cmd():
"""
Access projects
Access and manage projects
"""
pass


@projects_cmd.command("describe")
Expand All @@ -27,8 +26,8 @@ def project_describe(ctx: click.Context, name: str):
try:
project = store.get_project(name)
except FeastObjectNotFoundException as e:
print(e)
exit(1)
print(str(e))
raise SystemExit(1)

print(
yaml.dump(
Expand Down Expand Up @@ -58,7 +57,7 @@ def project_current(ctx: click.Context):
)


@projects_cmd.command(name="list")
@projects_cmd.command("list")
@tagsOption
@click.pass_context
def project_list(ctx: click.Context, tags: list[str]):
Expand All @@ -75,6 +74,43 @@ def project_list(ctx: click.Context, tags: list[str]):

print(
tabulate(
table, headers=["NAME", "DESCRIPTION", "TAGS", "OWNER"], tablefmt="plain"
table,
headers=["NAME", "DESCRIPTION", "TAGS", "OWNER"],
tablefmt="plain",
)
)


@projects_cmd.command("delete")
@click.argument("name", type=click.STRING)
@click.option(
"--yes",
"-y",
is_flag=True,
help="Skip confirmation prompt and delete immediately.",
)
@click.pass_context
def project_delete(ctx: click.Context, name: str, yes: bool):
"""
Delete a project and all its resources from the registry.

This removes the project entry from the registry. Individual objects
(feature views, entities, data sources) that belong to the project
are also purged when commit=True (the default).
"""
store = create_feature_store(ctx)

if not yes:
click.confirm(
f"Are you sure you want to delete project '{name}'? "
"This will remove all associated resources from the registry.",
abort=True,
)

try:
store.registry.delete_project(name, commit=True)
except (FeastObjectNotFoundException, ProjectNotFoundException) as e:
print(str(e))
raise SystemExit(1)

print(f"Project '{name}' deleted successfully.")

Back | FazBrowse Home | New Git URL