Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions sdk/python/feast/cli/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,38 @@ def project_current(ctx: click.Context):
)


@projects_cmd.command("delete")
@click.argument("name", type=click.STRING)
@click.option(
"--yes",
"-y",
is_flag=True,
default=False,
help="Skip confirmation prompt.",
)
@click.pass_context
def project_delete(ctx: click.Context, name: str, yes: bool):
"""
Delete a project and all its registered objects.
"""
store = create_feature_store(ctx)

try:
store.get_project(name)
except FeastObjectNotFoundException as e:
print(e)
exit(1)

if not yes:
click.confirm(
f"This will permanently delete project '{name}' and all its registered objects. Are you sure?",
abort=True,
)

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


@projects_cmd.command(name="list")
@tagsOption
@click.pass_context
Expand Down
13 changes: 13 additions & 0 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -3401,6 +3401,19 @@ def get_project(self, name: Optional[str]) -> Project:
"""
return self.registry.get_project(name or self.project)

def delete_project(self, name: str, commit: bool = True) -> None:
"""
Deletes a project from the registry.

Args:
name: Name of the project to delete.
commit: Whether the change should be persisted immediately.

Raises:
ProjectObjectNotFoundException: The project could not be found.
Comment thread
shuchu marked this conversation as resolved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ProjectObjectNotFoundException: The project could not be found.
ProjectNotFoundException: The project could not be found.

"""
return self.registry.delete_project(name, commit=commit)

def list_saved_datasets(
self, allow_cache: bool = False, tags: Optional[dict[str, str]] = None
) -> List[SavedDataset]:
Expand Down
Loading