class HashKey(TerminusKey)Generating ID with SHA256 using provided keys
class LexicalKey(TerminusKey)Generating ID with urllib.parse.quote using provided keys
class ValueHashKey(TerminusKey)Generating ID with SHA256
class RandomKey(TerminusKey)Generating ID with UUID4
class Schema()def add_enum_class(class_name: str, class_values: list)Construct a TerminusDB Enum class by provideing class name and member values then add into the schema.
Arguments:
class_name(str): Name of the class object constructed.class_values(list): A list of values in this Enum.
Returns:
EnumMetaTemplate: A Enum object with the sepcified name and members
def commit(client: Client,
commit_msg: Optional[str] = None,
full_replace=False)Commit the schema to database
Arguments:
client(Client): A client that is connected to a database.commit_msg(str): Commit message.full_replace(bool): Does the commit fully wiped out the old shcema graph. Default to be False.
def from_db(client: Client, select: Optional[List[str]] = None)Load classes in the database schema into schema
Arguments:
client(Client): Client that is connected to the databaseselect(list of str): The classes (and depended classes) that will be imported, default to None which will import all classes
def import_objects(obj_dict: Union[List[dict], dict])Import a list of documents in json format to Python objects. The schema of those documents need to be in this schema.
def from_json_schema(name: str,
json_schema: Union[dict, str, StringIO],
pipe=False,
subdoc=False)Load class object from json schema (http://json-schema.org/) and, if pipe mode is off, add into schema. All referenced object will be treated as subdocuments.
Arguments:
name(str): Name of the class object.json_schema(dict or str or StringIO): Json Schema in dictionary or jsonisable string format or json file stream.pipe(bool): Pipe mode, if True will return the schema in TerminusDB dictionary format (just like calling to_dict) WITHOUT loading the schema into the schema object. Default to False.subdoc(bool): If not in pipe mode, the class object will be added as a subdocument class.
def to_dict()Return the schema in the TerminusDB dictionary format
def to_json_schema(class_object: Union[str, dict])Return the schema in the json schema (http://json-schema.org/) format as a dictionary for the class object.
Arguments:
class object(str or dict): Name of the class object or the class object represented as dictionary.