Snowflake example
- Python
- Scala
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()
import ai.h2o.featurestore.Client
import ai.h2o.featurestore.core.sources.{Proxy, SnowflakeTable}
// Initialise feature store client
val client = Client("url")
client.auth.login()
// Set project specifics
val project = client.projects.create("demo")
// Create a snowflake table source
val proxy = new Proxy("url", "port", "username", "password")
val snowflakeTable = SnowflakeTable("<snowflake account url>", "warehouse name", "database name", "schema name", "table name", insecure=false, proxy=proxy, role="role", account="account")
val snowflakeTableSchema = client.extractSchemaFromSource(snowflakeTable)
// Create a snowflake query source
val snowflakeQuery = SnowflakeTable("<snowflake account url>", "warehouse name", "database name", "schema name", query="<sql select query>")
val snowflakeQuerySchema = client.extractSchemaFromSource(snowflakeQuery)
// Register the feature set
val myFeatureSet1 = project.featureSets.register(snowflakeTableSchema, "featureSet1", primaryKey=Seq("keyName"))
val myFeatureSet2 = project.featureSets.register(snowflakeQuerySchema, "featureSet2", primaryKey=Seq("keyName"))
// Ingest to cache
myFeatureSet1.ingest(snowflakeTable)
myFeatureSet2.ingest(snowflakeQuery)
// Retrieve feature set
val ref = myFeatureSet1.retrieve()
ref.download()
val ref = myFeatureSet2.retrieve()
ref.download()
Feedback
- Submit and view feedback for this page
- Send feedback about H2O Feature Store to cloud-feedback@h2o.ai