MCPcopy Create free account
hub / github.com/feast-dev/feast / _get_entity_schema

Function _get_entity_schema

sdk/python/feast/infra/offline_stores/bigquery.py:1428–1442  ·  view source on GitHub ↗
(
    client: Client, entity_df: Union[pd.DataFrame, str]
)

Source from the content-addressed store, hash-verified

1426
1427
1428def _get_entity_schema(
1429 client: Client, entity_df: Union[pd.DataFrame, str]
1430) -> Dict[str, np.dtype]:
1431 if isinstance(entity_df, str):
1432 entity_df_sample = (
1433 client.query(f"SELECT * FROM ({entity_df}) LIMIT 0").result().to_dataframe()
1434 )
1435
1436 entity_schema = dict(zip(entity_df_sample.columns, entity_df_sample.dtypes))
1437 elif isinstance(entity_df, pd.DataFrame):
1438 entity_schema = dict(zip(entity_df.columns, entity_df.dtypes))
1439 else:
1440 raise InvalidEntityType(type(entity_df))
1441
1442 return entity_schema
1443
1444
1445def _get_entity_df_event_timestamp_range(

Callers 1

Calls 4

InvalidEntityTypeClass · 0.90
resultMethod · 0.80
to_dataframeMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected