Skip to content

Commit b9ae6d3

Browse files
committed
Make name parameter required
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
1 parent 079eabd commit b9ae6d3

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

sdk/python/feast/entity.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Entity:
6060
def __init__(
6161
self,
6262
*,
63-
name: Optional[str] = None,
63+
name: str,
6464
join_keys: Optional[List[str]] = None,
6565
description: str = "",
6666
tags: Optional[Dict[str, str]] = None,
@@ -71,20 +71,17 @@ def __init__(
7171
7272
Args:
7373
name: The unique name of the entity.
74-
join_keys: A list of properties that uniquely identifies different entities within the
75-
collection. This currently only supports a list of size one, but is intended to
76-
eventually support multiple join keys.
77-
description: A human-readable description.
78-
tags: A dictionary of key-value pairs to store arbitrary metadata.
79-
owner: The owner of the entity, typically the email of the primary maintainer.
74+
join_keys (optional): A list of properties that uniquely identifies different entities
75+
within the collection. This currently only supports a list of size one, but is
76+
intended to eventually support multiple join keys.
77+
description (optional): A human-readable description.
78+
tags (optional): A dictionary of key-value pairs to store arbitrary metadata.
79+
owner (optional): The owner of the entity, typically the email of the primary maintainer.
8080
8181
Raises:
8282
ValueError: Parameters are specified incorrectly.
8383
"""
84-
if not name:
85-
raise ValueError("Name needs to be specified")
8684
self.name = name
87-
8885
self.value_type = ValueType.UNKNOWN
8986

9087
# For now, both the `join_key` and `join_keys` attributes are set correctly,

sdk/python/tests/unit/test_entity.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
import assertpy
15+
import pytest
1516

1617
from feast.entity import Entity
1718
from feast.value_type import ValueType
@@ -42,6 +43,11 @@ def test_entity_without_description():
4243
_ = Entity(name="my-entity")
4344

4445

46+
def test_entity_without_name():
47+
with pytest.raises(TypeError):
48+
_ = Entity()
49+
50+
4551
def test_name_not_specified():
4652
assertpy.assert_that(lambda: Entity()).raises(ValueError)
4753

0 commit comments

Comments
 (0)