Schema
terminusdb_client.schema
terminusdb_client.schema.schema
HashKey Objects
Generating ID with SHA256 using provided keys
LexicalKey Objects
Generating ID with urllib.parse.quote using provided keys
ValueHashKey Objects
Generating ID with SHA256
RandomKey Objects
Generating ID with UUID4
Schema Objects
add_enum_class
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
commit
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.
from_db
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
import_objects
Import a list of documents in json format to Python objects. The schema of those documents need to be in this schema.
from_json_schema
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.
to_dict
Return the schema in the TerminusDB dictionary format
to_json_schema
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.
Last updated