MongoDb example
- Python
- Scala
from featurestore import Client, MongoDbCollection
# Initialise feature store client
client = Client("ip:port")
client.auth.login()
# Set project specifics
project = client.projects.create("demo")
# Create the jdbc source
mongo_db_source = MongoDbCollection("mongodb+srv://some_cluster.mongodb.net/test", database="sample_guides", collection="planets")
schema = client.extract_schema_from_source(mongo_db_source)
# Register the feature set
my_feature_set = project.feature_sets.register(schema, "feature_set_name", primary_key="_id")
# Quick look on the data
my_feature_set.get_preview()
import ai.h2o.featurestore.Client
import ai.h2o.featurestore.core.sources.MongoDbCollection
// Initialise feature store client
val client = Client("url")
client.auth.setAuthToken(...)
// Set project specifics
val project = client.projects.create("demo")
// Create the jdbc source
val mongoDbSource = MongoDbCollection("mongodb+srv://some_cluster.mongodb.net/test", database="sample_guides", collection="planets"
val schema = client.extractSchemaFromSource(mongoDbSource)
// Register the feature set
val myFeatureSet = project.featureSets.register(schema, "featureSetName", primaryKey="keyName")
// Ingest to cache
myFeatureSet.ingest(jdbcSource)
// Quick look on the data
myFeatureSet.getPreview()
Feedback
- Submit and view feedback for this page
- Send feedback about H2O Feature Store to cloud-feedback@h2o.ai