Skip to content

Commit 56e0d01

Browse files
author
Joost Rothweiler
committed
Set default project on python client and create non existing projects on apply()
1 parent 40b67c0 commit 56e0d01

2 files changed

Lines changed: 3 additions & 33 deletions

File tree

examples/basic/basic.ipynb

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -150,38 +150,6 @@
150150
"client = Client(core_url=FEAST_CORE_URL, serving_url=FEAST_ONLINE_SERVING_URL)"
151151
]
152152
},
153-
{
154-
"cell_type": "markdown",
155-
"metadata": {},
156-
"source": [
157-
"Create a project workspace"
158-
]
159-
},
160-
{
161-
"cell_type": "code",
162-
"execution_count": null,
163-
"metadata": {},
164-
"outputs": [],
165-
"source": [
166-
"client.create_project('customer_project')"
167-
]
168-
},
169-
{
170-
"cell_type": "markdown",
171-
"metadata": {},
172-
"source": [
173-
"Set the active project"
174-
]
175-
},
176-
{
177-
"cell_type": "code",
178-
"execution_count": null,
179-
"metadata": {},
180-
"outputs": [],
181-
"source": [
182-
"client.set_project('customer_project')"
183-
]
184-
},
185153
{
186154
"cell_type": "markdown",
187155
"metadata": {},

sdk/python/feast/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Client:
8484
"""
8585

8686
def __init__(
87-
self, core_url: str = None, serving_url: str = None, project: str = None,
87+
self, core_url: str = None, serving_url: str = None, project: str = 'default',
8888
core_secure: bool = None, serving_secure: bool = None
8989
):
9090
"""
@@ -363,6 +363,8 @@ def apply(self, feature_sets: Union[List[FeatureSet], FeatureSet]):
363363
Args:
364364
feature_sets: List of feature sets that will be registered
365365
"""
366+
if self.project is not None and self.project not in self.list_projects():
367+
self.create_project(self.project)
366368
if not isinstance(feature_sets, list):
367369
feature_sets = [feature_sets]
368370
for feature_set in feature_sets:

0 commit comments

Comments
 (0)