Delta table example
- Python
- Scala
from featurestore import Client, DeltaTable
# Initialise feature store client
client = Client("ip:port")
fclient.auth.login()
# Set project specifics
project = client.projects.create("demo")
# Create the delta table source
delta = DeltaTable("<path to delta table>")
delta_schema = client.extract_schema_from_source(delta)
# Register the feature set
my_feature_set = project.feature_sets.register(delta_schema, "feature_set_name", primary_key=["key_name"])
# Ingest to cache
my_feature_set.ingest(delta)
# Retrieve feature set
ref = my_feature_set.retrieve()
ref.download()
import ai.h2o.featurestore.Client
import ai.h2o.featurestore.core.sources.DeltaTable
// Initialise feature store client
val client = Client("url")
client.auth.login()
// Set project specifics
val project = client.projects.create("demo")
// Create the delta table source
val delta = DeltaTable("<path to delta table>")
val deltaSchema = client.extractSchemaFromSource(delta)
// Register the feature set
val myFeatureSet = project.featureSets.register(deltaSchema, "featureSetName", primaryKey=Seq("keyName"))
// Ingest to cache
myFeatureSet.ingest(delta)
// Retrieve feature set
val ref = myFeatureSet.retrieve()
ref.download()
How to apply a filter on Delta table
- Python
- Scala
from featurestore import DeltaTable, DeltaTableFilter
delta_table_filter = DeltaTableFilter(column=..., operator=..., value=...)
delta_source = DeltaTable(path=..., filter=delta_table_filter)
import ai.h2o.featurestore.core.source.{DeltaTable, DeltaTableFilter}
val deltaTableFilter = DeltaTableFilter(column=..., operator=..., value=...)
val deltaSource = DeltaTable(path=..., filter=deltaTableFilter)
Feedback
- Submit and view feedback for this page
- Send feedback about H2O Feature Store to cloud-feedback@h2o.ai