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

Function _upload_entity_df

sdk/python/feast/infra/offline_stores/snowflake.py:1247–1272  ·  view source on GitHub ↗
(
    entity_df: Union[pd.DataFrame, str],
    snowflake_conn: SnowflakeConnection,
    config: RepoConfig,
    table_name: str,
)

Source from the content-addressed store, hash-verified

1245
1246
1247def _upload_entity_df(
1248 entity_df: Union[pd.DataFrame, str],
1249 snowflake_conn: SnowflakeConnection,
1250 config: RepoConfig,
1251 table_name: str,
1252) -> None:
1253 if isinstance(entity_df, pd.DataFrame):
1254 # Write the data from the DataFrame to the table
1255 # Known issues with following entity data types: BINARY
1256 write_pandas(
1257 snowflake_conn,
1258 entity_df,
1259 table_name,
1260 auto_create_table=True,
1261 create_temp_table=True,
1262 )
1263
1264 return None
1265 elif isinstance(entity_df, str):
1266 # If the entity_df is a string (SQL query), create a Snowflake table out of it,
1267 query = f'CREATE TEMPORARY TABLE "{table_name}" AS ({entity_df})'
1268 execute_snowflake_statement(snowflake_conn, query)
1269
1270 return None
1271 else:
1272 raise InvalidEntityType(type(entity_df))
1273
1274
1275def _fix_entity_selections_identifiers(query_context) -> list:

Callers 1

query_generatorMethod · 0.70

Calls 3

write_pandasFunction · 0.90
InvalidEntityTypeClass · 0.90

Tested by

no test coverage detected