Skip to main content
Version: 0.19.3

Snowflake example

from featurestore import Client, SnowflakeTable

# Initialise feature store client
client = Client("ip:port")
client.auth.login()

# Set project specifics
project = client.projects.create("demo")

# Create a snowflake table source
proxy = Proxy("url", "port", "username", "password")
snowflake_table = SnowflakeTable("<snowflake account url>", "warehouse name", "database name", "schema name", "table name", insecure=False, proxy=proxy, role="role", account="account name")
snowflake_table_schema = client.extract_schema_from_source(snowflake_table)

# Create a snowflake query source
snowflake_query = SnowflakeTable("<snowflake account url>", "warehouse name", "database name", "schema name", query="<sql select query>")
snowflake_query_schema = client.extract_schema_from_source(snowflake_query)

# Register the feature set
my_feature_set_1 = project.feature_sets.register(snowflake_table_schema, "feature_set_1", primary_key=["key_name"])
my_feature_set_2 = project.feature_sets.register(snowflake_query_schema, "feature_set_2", primary_key=["key_name"])

# Ingest to cache
my_feature_set_1.ingest(snowflake_table)
my_feature_set_2.ingest(snowflake_query)

# Retrieve feature set
ref = my_feature_set_1.retrieve()
ref.download()
ref = my_feature_set_2.retrieve()
ref.download()

Feedback