Evolve the schema
A feature set's schema is fixed at registration. Use these calls to read it back, compare it against a new data source, and carry metadata across before creating a new version.
Getting schema
To get feature set's schema, run:
- Python
workspace = client.workspaces.list(name="my_workspace")[0]
fs = workspace.feature_sets.get_by_name("gdp")
fs.schema.get()
Checking schema compatibility
To compare feature set's schema with the new data source's schema, run:
- Python
from h2o_featurestore import CSVFile
workspace = client.workspaces.list(name="my_workspace")[0]
fs = workspace.feature_sets.get_by_name("gdp")
source = CSVFile("<path to csv file>")
new_schema = workspace.extract_schema_from_source(source)
fs.schema.is_compatible_with(new_schema, compare_data_types=True)
Parameters explanation:
- Python
-
new_schemanew schema to check compatibility with. -
compare_data_typesaccepts True/False, indicates whether data type needs to be compared or not.- If
compare_data_typesisTrue, then data types for features with same name will be verified. - If
compare_data_typesisFalse, then data types for features with same name will not be verified.
- If
Patching new schema
Patch schema checks for matching features between the 'new schema' and the existing 'fs.schema'. If there is a match, then the meta data such as special_data, description etc are copied into the new_schema
To patch the new schema with feature set's schema, run:
- Python
from h2o_featurestore import CSVFile
workspace = client.workspaces.list(name="my_workspace")[0]
fs = workspace.feature_sets.get_by_name("gdp")
source = CSVFile("<path to csv file>")
new_schema = workspace.extract_schema_from_source(source)
fs.schema.patch_from(new_schema, compare_data_types=True)
Parameters explanation:
- Python
-
new_schemanew schema that needs to be patched. -
compare_data_typesaccepts True/False, indicates whether data type are to be compared while patching.- If
compare_data_typesisTrue, then data type from feature set schema is retained for features with same name and different types. - If
compare_data_typesisFalse, then data type from new schema is retained for features with same name and different types.
- If
- Submit and view feedback for this page
- Send feedback about H2O Feature Store to cloud-feedback@h2o.ai