Entity Overview

Features created via the feature store are tied to a specific business entity. Take for example registered users, transactions, or merchants.

A single entity may be related to multiple different feature sets.

Creating an Entity


from qwak.feature_store.entities import Entity

user = Entity(
    name='user_id',
    description='A Registered user entity',
  	key='user_id',
)

Name

The column name that will be used to join the data sources for extraction

πŸ“˜

Naming Conventions

Name is case insensitive - "user" and "User" are considered as the same entity.

Description

User-friendly description of the entity.

Connecting Feature Sets and Entities

We can connect entities and feature sets by using the name of the entity in the feature set entity field.

from qwak.feature_store.v1 import batch, SparkSqlTransformation
from qwak.feature_store.entities import Entity

user = Entity(
    name='user_id',
    description='A Registered user entity',
  	key='user_id',
)

@batch.feature_set(
    entity="user_id",
    data_sources = {
        "snowflake": ReadPolicy.NewOnly
    })
)
def user_features():
    return SparkSqlTransformation(sql="""
        SELECT user_id,
               registration_country,
               registration_device,
               date_created
        FROM snowflake_users_table
    """)