Skip to main content
Version: v3.0.2

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:

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:

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:

  • new_schema new schema to check compatibility with.

  • compare_data_types accepts True/False, indicates whether data type needs to be compared or not.

    • If compare_data_types is True, then data types for features with same name will be verified.
    • If compare_data_types is False, then data types for features with same name will not be verified.

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:

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:

  • new_schema new schema that needs to be patched.

  • compare_data_types accepts True/False, indicates whether data type are to be compared while patching.

    • If compare_data_types is True, then data type from feature set schema is retained for features with same name and different types.
    • If compare_data_types is False, then data type from new schema is retained for features with same name and different types.

Feedback