JSON Decoder¶
Contains methods to decode components of a Profiler.
- dataprofiler.profilers.json_decoder.get_column_profiler_class(class_name: str) type[BaseColumnProfiler] ¶
Use name of class to return default-constructed version of that class.
- Raises ValueError if class_name is not name of a subclass of
BaseColumnProfiler.
- Parameters
class_name (str representing name of class) – name of BaseColumnProfiler subclass retrieved by calling type(instance).__name__
- Returns
subclass of BaseColumnProfiler object
- dataprofiler.profilers.json_decoder.get_compiler_class(class_name: str) type[col_pro_compiler.BaseCompiler] ¶
Use name of class to return default-constructed version of that class.
- Raises ValueError if class_name is not name of a subclass of
BaseCompiler.
- Parameters
class_name (str representing name of class) – name of BaseCompiler subclass retrieved by calling type(instance).__name__
- Returns
subclass of BaseCompiler object
- dataprofiler.profilers.json_decoder.get_option_class(class_name: str) type[BaseOption] ¶
Use name of class to return default-constructed version of that class.
- Raises ValueError if class_name is not name of a subclass of
BaseOptions.
- Parameters
class_name (str representing name of class) – name of BaseOptions subclass retrieved by calling type(instance).__name__
- Returns
subclass of BaseOptions object
- dataprofiler.profilers.json_decoder.get_profiler_class(class_name: str) type[BaseProfiler] ¶
Use name of class to return default-constructed version of that class.
- Raises ValueError if class_name is not name of a subclass of
BaseProfiler.
- Parameters
class_name (str representing name of class) – name of BaseProfiler subclass retrieved by calling type(instance).__name__
- Raises
ValueError if the profiler class does not exist
- Returns
subclass of BaseProfiler object
- dataprofiler.profilers.json_decoder.get_structured_col_profiler_class(class_name: str) type[StructuredColProfiler] ¶
Use name of class to return default-constructed version of that class.
- Raises ValueError if class_name is not name of a subclass of
StructuredColProfiler.
- Parameters
class_name (str representing name of class) – name of StructuredColProfiler subclass retrieved by calling type(instance).__name__
- Returns
subclass of StructuredColProfiler object
- dataprofiler.profilers.json_decoder.load_column_profile(serialized_json: dict, config: dict | None = None) BaseColumnProfiler ¶
Construct subclass of BaseColumnProfiler given a serialized JSON.
- Expected format of serialized_json (see json_encoder):
- {
“class”: <str name of class that was serialized> “data”: {
<attr1>: <value1> <attr2>: <value2> …
}
}
- Parameters
serialized_json (a dict that was created by calling json.loads on a JSON representation using the custom encoder) – JSON representation of column profiler that was serialized using the custom encoder in profilers.json_encoder
config (Dict | None) – config for overriding data params when loading from dict
- Returns
subclass of BaseColumnProfiler that has been deserialized from JSON
- dataprofiler.profilers.json_decoder.load_compiler(serialized_json: dict, config: dict | None = None) col_pro_compiler.BaseCompiler ¶
Construct subclass of BaseCompiler given a serialized JSON.
- Expected format of serialized_json (see json_encoder):
- {
“class”: <str name of class that was serialized> “data”: {
<attr1>: <value1> <attr2>: <value2> …
}
}
- Parameters
serialized_json (a dict that was created by calling json.loads on a JSON representation using the custom encoder) – JSON representation of profile compiler that was serialized using the custom encoder in profilers.json_encoder
config (Dict | None) – config for overriding data params when loading from dict
- Returns
subclass of BaseCompiler that has been deserialized from JSON
- dataprofiler.profilers.json_decoder.load_option(serialized_json: dict, config: dict | None = None) BaseOption ¶
Construct subclass of BaseOption given a serialized JSON.
- Expected format of serialized_json (see json_encoder):
- {
“class”: <str name of class that was serialized> “data”: {
<attr1>: <value1> <attr2>: <value2> …
}
}
- Parameters
serialized_json (a dict that was created by calling json.loads on a JSON representation using the custom encoder) – JSON representation of option that was serialized using the custom encoder in profilers.json_encoder
config (Dict | None) – config for overriding data params when loading from dict
- Returns
subclass of BaseOption that has been deserialized from JSON
- dataprofiler.profilers.json_decoder.load_profiler(serialized_json: dict, config=None) BaseProfiler ¶
Construct subclass of BaseProfiler given a serialized JSON.
- Expected format of serialized_json (see json_encoder):
- {
“class”: <str name of class that was serialized> “data”: {
<attr1>: <value1> <attr2>: <value2> …
}
}
- Parameters
serialized_json (a dict that was created by calling json.loads on a JSON representation using the custom encoder) – JSON representation of column profiler that was serialized using the custom encoder in profilers.json_encoder
config (Dict | None) – config for overriding data params when loading from dict
- Returns
subclass of BaseProfiler that has been deserialized from JSON
- dataprofiler.profilers.json_decoder.load_structured_col_profiler(serialized_json: dict, config: dict | None = None) StructuredColProfiler ¶
Construct subclass of BaseProfiler given a serialized JSON.
- Expected format of serialized_json (see json_encoder):
- {
“class”: <str name of class that was serialized> “data”: {
<attr1>: <value1> <attr2>: <value2> …
}
}
- Parameters
serialized_json (a dict that was created by calling json.loads on a JSON representation using the custom encoder) – JSON representation of column profiler that was serialized using the custom encoder in profilers.json_encoder
config (Dict | None) – config for overriding data params when loading from dict
- Returns
subclass of BaseCompiler that has been deserialized from JSON