Skip to content

Commit 9761ccb

Browse files
Chen Zhilingfeast-ci-bot
authored andcommitted
Update cli with project-related commands (feast-dev#397)
1 parent 0fcf08e commit 9761ccb

2 files changed

Lines changed: 57 additions & 7 deletions

File tree

sdk/python/cli.py

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ def feature_set():
129129
pass
130130

131131

132-
@feature_set.command()
133-
def list():
132+
@feature_set.command(name="list")
133+
def feature_set_list():
134134
"""
135135
List all feature sets
136136
"""
@@ -147,9 +147,9 @@ def list():
147147
print(tabulate(table, headers=["NAME", "VERSION"], tablefmt="plain"))
148148

149149

150-
@feature_set.command()
150+
@feature_set.command("create")
151151
@click.argument("name")
152-
def create(name):
152+
def feature_set_create(name):
153153
"""
154154
Create a feature set
155155
"""
@@ -160,10 +160,10 @@ def create(name):
160160
feast_client.apply(FeatureSet(name=name))
161161

162162

163-
@feature_set.command()
163+
@feature_set.command("describe")
164164
@click.argument("name", type=click.STRING)
165165
@click.argument("version", type=click.INT)
166-
def describe(name: str, version: int):
166+
def feature_set_describe(name: str, version: int):
167167
"""
168168
Describe a feature set
169169
"""
@@ -181,6 +181,56 @@ def describe(name: str, version: int):
181181
print(yaml.dump(yaml.safe_load(str(fs)), default_flow_style=False, sort_keys=False))
182182

183183

184+
@cli.group(name="projects")
185+
def project():
186+
"""
187+
Create and manage projects
188+
"""
189+
pass
190+
191+
192+
@project.command(name="create")
193+
@click.argument("name", type=click.STRING)
194+
def project_create(name: str):
195+
"""
196+
Create a project
197+
"""
198+
feast_client = Client(
199+
core_url=feast_config.get_config_property_or_fail("core_url")
200+
) # type: Client
201+
feast_client.create_project(name)
202+
203+
204+
@project.command(name="archive")
205+
@click.argument("name", type=click.STRING)
206+
def project_archive(name: str):
207+
"""
208+
Archive a project
209+
"""
210+
feast_client = Client(
211+
core_url=feast_config.get_config_property_or_fail("core_url")
212+
) # type: Client
213+
feast_client.archive_project(name)
214+
215+
216+
@project.command(name="list")
217+
def feature_set_list():
218+
"""
219+
List all projects
220+
"""
221+
feast_client = Client(
222+
core_url=feast_config.get_config_property_or_fail("core_url")
223+
) # type: Client
224+
225+
table = []
226+
for project in feast_client.list_projects():
227+
table.append([project])
228+
229+
from tabulate import tabulate
230+
231+
print(tabulate(table, headers=["NAME"], tablefmt="plain"))
232+
233+
184234
@cli.command()
185235
@click.option(
186236
"--name", "-n", help="Feature set name to ingest data into", required=True

sdk/python/feast/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def list_projects(self) -> List[str]:
265265
) # type: ListProjectsResponse
266266
return list(response.projects)
267267

268-
def create_project(self, project):
268+
def create_project(self, project: str):
269269
"""
270270
Creates a Feast project
271271

0 commit comments

Comments
 (0)