aito.schema.AitoColumnTypeSchema¶
-
class
aito.schema.
AitoColumnTypeSchema
(data_type: aito.schema.AitoDataTypeSchema, nullable: bool = None, link: aito.schema.AitoColumnLinkSchema = None, analyzer: aito.schema.AitoAnalyzerSchema = None)¶ Bases:
aito.schema.AitoSchema
Aito ColumnType schema
- Parameters
data_type (AitoDataTypeSchema) – the type of the column
nullable (bool, default to False) – when true, null values are allowed
link (AitoColumnLink, optional) – path to a linked column
analyzer (AnalyzerSchema, optional) – the analyzer of the column if the column is of type Text
Methods
create a class object from a JSON deserialized object
from_json_string
(json_string, **kwargs)create an class object from a JSON string
infer_from_samples
(samples[, max_sample_size])infer AitoColumnType from the given samples
the JSON schema of the class
json_schema_validate
(obj)Validate an object with the class json_schema Returns the object if validation success, else raise
JsonValidationError
json_schema_validate_with_schema
(obj, schema)Validate an object with the given schema
to_conversion
()convert the object to an object that can be serialized to a JSON formatted string
to_json_string
(**kwargs)convert the object to a JSON string
Attributes
the analyzer of the column
column_link_pattern
column_name_pattern
properties of the schema object that will be used for comparison operation
The data type of the column
return true if the column is linked to another column
the link of the column
returns True if the column allow null value
table_name_pattern
the type of the schema component
uuid_pattern
-
property
analyzer
¶ the analyzer of the column
- Return type
-
property
comparison_properties
¶ properties of the schema object that will be used for comparison operation
- Return type
Iterable[str]
-
property
data_type
¶ The data type of the column
- Return type
-
classmethod
from_deserialized_object
(obj: Dict)¶ create a class object from a JSON deserialized object
-
classmethod
from_json_string
(json_string: str, **kwargs)¶ create an class object from a JSON string
- Parameters
json_string (str) – the JSON string
kwargs – the keyword arguments for json.loads method
-
property
has_link
¶ return true if the column is linked to another column
-
classmethod
infer_from_samples
(samples: Iterable, max_sample_size: int = 100000) → aito.schema.AitoColumnTypeSchema¶ infer AitoColumnType from the given samples
- Parameters
samples (Iterable) – iterable of sample
max_sample_size (int) – at most first max_sample_size will be used for inference, defaults to 100000
- Returns
inferred Aito column type
- Return type
str
-
classmethod
json_schema
()¶ the JSON schema of the class
- Return type
Dict
-
classmethod
json_schema_validate
(obj: Any)¶ Validate an object with the class json_schema Returns the object if validation success, else raise
JsonValidationError
- Parameters
obj (Any) – the object to be validated
- Returns
the object if validation succeed
- Return type
Any
-
json_schema_validate_with_schema
(obj: Any, schema: Dict)¶ Validate an object with the given schema
- Parameters
obj (Any) – the object to be validated
schema (Dict) – the schema to be validate against
- Returns
the object if validation succeed
- Return type
Any
-
property
link
¶ the link of the column
- Return type
-
property
nullable
¶ returns True if the column allow null value
- Return type
bool
-
to_json_serializable
()¶ convert the object to an object that can be serialized to a JSON formatted string
-
to_json_string
(**kwargs)¶ convert the object to a JSON string
- Parameters
kwargs – the keyword arguments for json.dumps method
- Return type
str
-
property
type
¶ the type of the schema component
- Return type
str