Skip to content

Commit 4229f45

Browse files
committed
fix: update default values for ApplyDataSourceRequestBody and ApplyFeatureViewRequestBody
Signed-off-by: Rohit Bharmal <[email protected]>
1 parent e5525a6 commit 4229f45

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

sdk/python/feast/api/registry/rest/data_sources.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class SparkOptionsModel(BaseModel):
6363
class ApplyDataSourceRequestBody(BaseModel):
6464
name: str
6565
project: str
66-
type: Optional[int] = 1
66+
type: Optional[int] = None
6767
timestamp_field: Optional[str] = ""
6868
created_timestamp_column: Optional[str] = ""
6969
description: Optional[str] = ""
@@ -212,13 +212,14 @@ def get_data_source(
212212
def apply_data_source(body: ApplyDataSourceRequestBody):
213213
ds_proto = DataSourceProto(
214214
name=body.name,
215-
type=body.type or 1, # type: ignore[arg-type]
216215
timestamp_field=body.timestamp_field or "",
217216
created_timestamp_column=body.created_timestamp_column or "",
218217
description=body.description or "",
219218
tags=body.tags or {},
220219
owner=body.owner or "",
221220
)
221+
if body.type is not None:
222+
ds_proto.type = body.type # type: ignore[assignment]
222223

223224
if body.file_options:
224225
ds_proto.file_options.uri = body.file_options.uri

sdk/python/feast/api/registry/rest/feature_views.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ApplyFeatureViewRequestBody(BaseModel):
4040
entities: Optional[List[str]] = []
4141
features: Optional[List[FeatureModel]] = []
4242
batch_source: Optional[str] = ""
43-
ttl_seconds: Optional[int] = 0
43+
ttl_seconds: Optional[int] = None
4444
online: Optional[bool] = True
4545
description: Optional[str] = ""
4646
tags: Optional[Dict[str, str]] = {}
@@ -313,7 +313,9 @@ def apply_feature_view(body: ApplyFeatureViewRequestBody):
313313
DataSourceProto(name=body.batch_source) if body.batch_source else None
314314
)
315315

316-
ttl = Duration(seconds=body.ttl_seconds) if body.ttl_seconds else None
316+
ttl = (
317+
Duration(seconds=body.ttl_seconds) if body.ttl_seconds is not None else None
318+
)
317319

318320
spec = FeatureViewSpec(
319321
name=body.name,
@@ -324,7 +326,7 @@ def apply_feature_view(body: ApplyFeatureViewRequestBody):
324326
description=body.description or "",
325327
owner=body.owner or "",
326328
)
327-
if ttl:
329+
if ttl is not None:
328330
spec.ttl.CopyFrom(ttl)
329331
if batch_source_proto:
330332
spec.batch_source.CopyFrom(batch_source_proto)

0 commit comments

Comments
 (0)