An Entity object contains metadata on an entity type represented or referenced by tables within your data warehouse.
Registering an entity in the catalog¶
To register an entity in the catalog, specify:
- The name you want to use for the entity.
- A list of serving names.
A serving name is an accepted name for the unique identifier employed to identify the entity during preview or serving requests. Generally, the serving name for an entity is the name of the primary key (or natural key) of the table representing the entity. However, an entity may have multiple serving names for convenience.
You can register a new entity using the
Tagging an Entity to Columns¶
# Tag the customer entity to GroceryInvoiceGuid in the customer table
customer_table = catalog.get_table("GROCERYCUSTOMER")
# Tag the customer entity to GroceryInvoiceGuid in the grocery invoice table
invoice_table = catalog.get_table("GROCERYINVOICE")
To remove an entity tag, set the entity name to None.
Retrieving Information on the Primary Entity of a Feature Object¶
The primary entity of a feature defines the level of analysis for that feature. In addition, it determines the entities that can be utilized to serve the feature. A feature can be served by its primary entity or any descendant serving entities.
# Get a view from the customer table
customer_view = catalog.get_view("GROCERYCUSTOMER")
# Extract operating system from BrowserUserAgent column
customer_view["OperatingSystemIsWindows"] = \
# Create a feature from the OperatingSystemIsWindows column
uses_windows = customer_view.OperatingSystemIsWindows.as_feature("UsesWindows")
# Display infomation on the primary entity of the new feature.
# This should return information on the Customer entity.
Serving Feature Values¶
To materialize feature values, you can either utilize the primary entity of the feature or any descendant entities of its primary entity (the serving entities). In the context of preview and historical feature serving, you need to combine entity key values and point-in-time references. You can perform this either through an observation set or an observation table where the name of the column representing key values must be one of the serving names accepted for the entity.
You can preview a feature using the
preview method as shown below:
Accessing an Entity from the Catalog¶
To retrieve an Entity object using its Object ID, use the