feast icon indicating copy to clipboard operation
feast copied to clipboard

Fetching historical feature values by passing sql as entity_df

Open TaherehFarrokhi opened this issue 3 years ago • 5 comments

Expected Behavior

In Feast version 0.18.1, it was poosible to get historical features by passing a sql query as entity_df and it returns the values

Current Behavior

When I updated or .24+ it returns error : string entities are currently not supported in the MsSQL offline store.

https://github.com/feast-dev/feast/blob/master/sdk/python/feast/infra/offline_stores/contrib/mssql_offline_store/mssql.py#L189

Steps to reproduce

this is my feast_store.yaml

registry:
  registry_store_type: AzureRegistryStore
  path: ${REGISTRY_PATH}
project: FinalUniverseY1
provider: azure
online_store:
    type: redis
    connection_string: ${REDIS_CONN}
offline_store:
    type: mssql
    connection_string: ${SQL_CONN}
  1. Defined entity
  2. define feature view
  3. Write this code:
 feature_view = self.feature_store.get_feature_view(fq.feature_view_name)
  entity = self.feature_store.get_entity(feature_view.entities[0])
  features = [f"{feature_view.name}:{f.name}" for f in feature_view.features]
      batch_source: MsSqlServerSource = feature_view.batch_source
 entity_df = f"select {entity.join_key}, {feature_view.batch_source.timestamp_field} as event_timestamp from [dbo].{batch_source.table_ref} where {batch_source.timestamp_field} between '{fq.from_date}' and '{fq.to_date}'"
      feature_service = self.feature_store.get_feature_service("test_service_1")
  job = self.feature_store.get_historical_features(
          entity_df=entity_df, features=feature_service
      )
 df = job.to_df()

Specifications

  • Version:0.24.1
  • Platform :Azure
  • Subsystem:

Possible Solution

TaherehFarrokhi avatar Sep 20 '22 09:09 TaherehFarrokhi

Any news on this one?

Nevermind-s avatar Dec 08 '22 22:12 Nevermind-s

Seems to me this is an implementation decision and not a bug (whether introduced or not), then this could be a feature request... The old version ran a SELECT INTO from sql string in the entity table

amommendes avatar Jan 06 '23 23:01 amommendes

I encountered a similar issue where the insertion operation defaults the string column in an entity table with varchar(1) which violates the length check.

tsenhungwu avatar Feb 08 '23 15:02 tsenhungwu

I believe this might have been just an incorrect gate. The other offline stores allow for this and it seemed to work in the old version. We should be able to re-enable this and fix any tests that are failing as a result

adchia avatar Feb 08 '23 16:02 adchia

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 10 '23 09:06 stale[bot]