aito.schema.AitoDatabaseSchema¶
-
class
aito.schema.
AitoDatabaseSchema
(tables: Dict[str, aito.schema.AitoTableSchema])¶ Bases:
aito.schema.AitoSchema
Aito Database Schema
Can be thought of as a dict-like container for
AitoTableSchema
objectsMethods
create a class object from a JSON deserialized object
from_json_string
(json_string, **kwargs)create an class object from a JSON string
has_table
(table_name)check if the database has the specified table
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
reachable_columns
(table_name)return the name of the columns that can be reached from the specified table if the table has link, including the columns of the table
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
column_link_pattern
column_name_pattern
properties of the schema object that will be used for comparison operation
table_name_pattern
a list contains the names of the database’s tables
a dictionary contains the name of the database’s tables and its corresponding schemas
the type of the schema component
uuid_pattern
-
property
comparison_properties
¶ properties of the schema object that will be used for comparison operation
- Return type
Iterable[str]
-
classmethod
from_deserialized_object
(obj)¶ 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
-
has_table
(table_name: str) → bool¶ check if the database has the specified table
- Parameters
table_name (str) – the name of the column
- Returns
true if the table has the specified column
- Return type
bool
-
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
-
reachable_columns
(table_name) → List[str]¶ return the name of the columns that can be reached from the specified table if the table has link, including the columns of the table
- Parameters
table_name (str) – the name of the table
- Returns
list of linked columns
- Return type
List[str]
-
property
tables
¶ a list contains the names of the database’s tables
- Return type
-
property
tables_schemas
¶ a dictionary contains the name of the database’s tables and its corresponding schemas
- Return type
Dict[str, AitoTableSchema]
-
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
-
property