Example #1
0
    def __init__(self,
                 name='',
                 entity='',
                 granularity=Granularity.NONE,
                 owner='',
                 value_type=ValueType.DOUBLE,
                 description='',
                 uri='',
                 warehouse_store=None,
                 serving_store=None,
                 group='',
                 tags=[],
                 options={}):
        """Create feast feature instance.
        
        Args:
            name (str): name of feature, in lower snake case
            entity (str): entity the feature belongs to, in lower case
            granularity (feast.sdk.resources.feature.Granularity):
                granularity of the feature
            owner (str): owner of the feature
            value_type (feast.sdk.resources.feature.ValueType): defaults to
                ValueType.DOUBLE. value type of the feature
            description (str): defaults to "". description of the feature
            uri (str): defaults to "". uri pointing to the source code or 
                origin of this feature
            warehouse_store (feast.sdk.resources.feature.Datastore):
                warehouse store id and options
            serving_store (feast.sdk.resources.feature.Datastore): serving
                store id and options
            group (str, optional): feature group to inherit from
            tags (list[str], optional): tags assigned to the feature
            options (dic, optional): additional options for the feature
        """
        id = '.'.join(
            [entity,
             Granularity_pb2.Enum.Name(granularity.value), name]).lower()

        warehouse_store_spec = None
        serving_store_spec = None
        if (serving_store is not None):
            serving_store_spec = serving_store.spec
        if (warehouse_store is not None):
            warehouse_store_spec = warehouse_store.spec
        data_stores = DataStores(serving=serving_store_spec,
                                 warehouse=warehouse_store_spec)
        self.__spec = FeatureSpec(id=id,
                                  granularity=granularity.value,
                                  name=name,
                                  entity=entity,
                                  owner=owner,
                                  dataStores=data_stores,
                                  description=description,
                                  uri=uri,
                                  valueType=value_type.value,
                                  group=group,
                                  tags=tags,
                                  options=options)
Example #2
0
    def __init__(self, id, tags=[], warehouse_store=None, serving_store=None):
        """Create FeatureGroup instance.

        Args:
            id (str): id of feature group
            tags (list): Defaults to []. tags assigned to feature group
                as well as all children features.
            warehouse_store (feast.sdk.resources.feature.Datastore):
                warehouse store id and options
            serving_store (feast.sdk.resources.feature.Datastore):
                serving store id and options
        """
        warehouse_store_spec = None
        serving_store_spec = None
        if (serving_store is not None):
            serving_store_spec = serving_store.spec
        if (warehouse_store is not None):
            warehouse_store_spec = warehouse_store.spec
        data_stores = DataStores(serving=serving_store_spec,
                                 warehouse=warehouse_store_spec)
        self.__spec = FeatureGroupSpec(id=id,
                                       tags=tags,
                                       dataStores=data_stores)
Example #3
0
 def _create_feature_spec(self, feature_id, wh_id):
     wh_store = DataStore(id=wh_id)
     datastores = DataStores(warehouse=wh_store)
     return FeatureSpec(id=feature_id, dataStores=datastores)