Skip to main content
Version: 0.9

Entity

Summary​

A Tecton Entity, used to organize and join features.

An Entity is a class that represents an Entity that is being modeled in Tecton. Entities are used to index and organize features - a FeatureView contains at least one Entity.

Entities contain metadata about join keys, which represent the columns that are used to join features together.

Attributes​

NameData TypeDescription
created_atOptional[datetime.datetime]The time that this Tecton object was created or last updated.
defined_inOptional[str]The repo filename where this object was declared.
descriptionstrReturns the description of the Tecton object.
idstrReturns the unique id of the Tecton object.
info
join_keysList[str]Join keys of the entity.
namestrReturns the name of the Tecton object.
ownerOptional[str]Returns the owner of the Tecton object.
tagsDict[str, str]Returns the tags of the Tecton object.
workspaceOptional[str]Returns the workspace that this Tecton object belongs to.

Methods​

NameDescription
__init__(...)Declare a new Entity.
summary()Displays a human readable summary of this Feature View.
validate()Validate this Tecton object and its dependencies (if any).

__init__(...)​

Declare a new Entity.

Parameters​

  • name (str) – Unique name for the new entity.

  • description (Optional[str]) – Short description of the new entity. (Default: None)

  • tags (Optional[Dict[str, str]]) – Tags associated with this Tecton Object (key-value pairs of arbitrary metadata). (Default: None)

  • owner (Optional[str]) – Owner name (typically the email of the primary maintainer). (Default: None)

  • prevent_destroy (bool) – If True, this Tecton object will be blocked from being deleted or re-created (i.e. a destructive update) during tecton plan/apply. To remove or update this object, prevent_destroy must be first set to False via the same tecton apply or a separate tecton apply. prevent_destroy can be used to prevent accidental changes such as inadvertently deleting a Feature Service used in production or recreating a Feature View that triggers expensive rematerialization jobs. prevent_destroy also blocks changes to dependent Tecton objects that would trigger a recreate of the tagged object, e.g. if prevent_destroy is set on a Feature Service, that will also prevent deletions or re-creates of Feature Views used in that service. prevent_destroy is only enforced in live (i.e. non-dev) workspaces. (Default: False)

  • join_keys (Union[str, List[str], None]) – Names of columns that uniquely identify the entity in FeatureView’s SQL statement for which features should be aggregated. Defaults to using name as the entity’s join key.

Raises​

  • TectonValidationError – if the input non-parameters are invalid.

Example​

from tecton import Entity

customer = Entity(
name="customer",
join_keys=["customer_id"],
description="A customer subscribing to a Sports TV subscription service",
)

summary()​

Displays a human readable summary of this Feature View.

validate()​

Validate this Tecton object and its dependencies (if any).

Validation performs most of the same checks and operations as tecton plan.

  1. Check for invalid object configurations, e.g. setting conflicting fields.

  2. For Data Sources and Feature Views, test query code and derive schemas. e.g. test that a Data Source’s specified s3 path exists or that a Feature View’s SQL code executes and produces supported feature data types.

Objects already applied to Tecton do not need to be re-validated on retrieval (e.g. fv = tecton.get_workspace('prod').get_feature_view('my_fv')) since they have already been validated during tecton plan. Locally defined objects (e.g. my_ds = BatchSource(name="my_ds", ...)) may need to be validated before some of their methods can be called, e.g. my_feature_view.get_features_for_events().

Was this page helpful?