Created
January 12, 2024 02:31
-
-
Save DPLATA/70b161bd29d13d5eb878265495ce160a to your computer and use it in GitHub Desktop.
Hopsworks feature push
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from dotenv import load_dotenv | |
from my_hopsworks.connector import FeatureStoreManager | |
load_dotenv() | |
hopsworks_api_key_value: str = os.environ.get("HOPSWORKS_API_KEY_VALUE") | |
manager = FeatureStoreManager(hopsworks_api_key_value) | |
users_fg = manager.fs.get_or_create_feature_group( | |
name="users", | |
version=1, | |
description="users data", | |
primary_key=["id"] | |
) | |
users_fg.insert( | |
u, | |
write_options={"wait_for_job": True}, | |
) | |
feature_descriptions = [ | |
{"name": "id", "description": "user id"}, | |
{"name": "age", "description": "age"}, | |
{"name": "name", "description": "name"}, | |
{"name": "email", "description": "contact email"}, | |
{"name": "title", "description": "title"}, | |
{"name": "gender", "description": "gender"}, | |
{"name": "height", "description": "height"}, | |
{"name": "weight", "description": "weight"}, | |
{"name": "address", "description": "contact address"}, | |
{"name": "language", "description": "primary contact language"}, | |
{"name": "telephone", "description": "primary contact telephone"}, | |
{"name": "blood_type", "description": "contact blood type"}, | |
{"name": "created_at", "description": "created at date"}, | |
{"name": "occupation", "description": "occupation"}, | |
{"name": "updated_at", "description": "updated at date"}, | |
{"name": "nationality", "description": "nationality"}, | |
{"name": "academic_degree", "description": "academic degree"}, | |
{"name": "average_age", "description": "nationality"}, | |
] | |
for desc in feature_descriptions: | |
users_fg.update_feature_description(desc["name"], desc["description"]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment