def replace_document(self, document: Union[(dict, List[dict], 'WOQLSchema', 'DocumentTemplate', List['DocumentTemplate'])], graph_type: str='instance', commit_msg: Optional[str]=None, last_data_version: Optional[str]=None, compress: Union[(str, int)]=1024, create: bool=False) -> None:
    'Updates the specified document(s)\n\n        Parameters\n        ----------\n        document: dict or list of dict\n            Document(s) to be updated.\n        graph_type : str\n            Graph type, either "instance" or "schema".\n        commit_msg : str\n            Commit message.\n        last_data_version : str\n            Last version before the update, used to check if the document has been changed unknowingly\n        compress : str or int\n            If it is an integer, size of the data larger than this (in bytes) will be compress with gzip in the request (assume encoding as UTF-8, 0 = always compress). If it is `never` it will never compress the data.\n        create : bool\n            Create the document if it does not yet exist.\n\n        Raises\n        ------\n        InterfaceError\n            if the client does not connect to a database\n        '
    self._validate_graph_type(graph_type)
    self._check_connection()
    params = self._generate_commit(commit_msg)
    params['graph_type'] = graph_type
    params['create'] = ('true' if create else 'false')
    headers = {'user-agent': f'terminusdb-client-python/{__version__}'}
    if (last_data_version is not None):
        headers['TerminusDB-Data-Version'] = last_data_version
    new_doc = self._convert_dcoument(document, graph_type)
    json_string = json.dumps(new_doc).encode('utf-8')
    if ((compress != 'never') and (len(json_string) > compress)):
        headers.update({'Content-Encoding': 'gzip', 'Content-Type': 'application/json'})
        result = requests.put(self._documents_url(), headers=headers, params=params, data=gzip.compress(json_string), auth=self._auth())
    else:
        result = requests.put(self._documents_url(), headers=headers, params=params, json=new_doc, auth=self._auth())
    result = json.loads(_finish_response(result))
    if isinstance(document, list):
        for (idx, item) in enumerate(document):
            if (hasattr(item, '_obj_to_dict') and (not hasattr(item, '_backend_id'))):
                item._backend_id = result[idx][len('terminusdb:///data/'):]
    return result
Updates the specified document(s)

Parameters
----------
document: dict or list of dict
    Document(s) to be updated.
graph_type : str
    Graph type, either "instance" or "schema".
commit_msg : str
    Commit message.
last_data_version : str
    Last version before the update, used to check if the document has been changed unknowingly
compress : str or int
    If it is an integer, size of the data larger than this (in bytes) will be compress with gzip in the request (assume encoding as UTF-8, 0 = always compress). If it is `never` it will never compress the data.
create : bool
    Create the document if it does not yet exist.

Raises
------
InterfaceError
    if the client does not connect to a database
def replace_document(self, document: Union[(dict, List[dict], 'WOQLSchema', 'DocumentTemplate', List['DocumentTemplate'])], graph_type: str='instance', commit_msg: Optional[str]=None, last_data_version: Optional[str]=None, compress: Union[(str, int)]=1024, create: bool=False) -> None:
    'Updates the specified document(s)\n\n        Parameters\n        ----------\n        document: dict or list of dict\n            Document(s) to be updated.\n        graph_type : str\n            Graph type, either "instance" or "schema".\n        commit_msg : str\n            Commit message.\n        last_data_version : str\n            Last version before the update, used to check if the document has been changed unknowingly\n        compress : str or int\n            If it is an integer, size of the data larger than this (in bytes) will be compress with gzip in the request (assume encoding as UTF-8, 0 = always compress). If it is `never` it will never compress the data.\n        create : bool\n            Create the document if it does not yet exist.\n\n        Raises\n        ------\n        InterfaceError\n            if the client does not connect to a database\n        '
    self._validate_graph_type(graph_type)
    self._check_connection()
    params = self._generate_commit(commit_msg)
    params['graph_type'] = graph_type
    params['create'] = ('true' if create else 'false')
    headers = {'user-agent': f'terminusdb-client-python/{__version__}'}
    if (last_data_version is not None):
        headers['TerminusDB-Data-Version'] = last_data_version
    new_doc = self._convert_dcoument(document, graph_type)
    json_string = json.dumps(new_doc).encode('utf-8')
    if ((compress != 'never') and (len(json_string) > compress)):
        headers.update({'Content-Encoding': 'gzip', 'Content-Type': 'application/json'})
        result = requests.put(self._documents_url(), headers=headers, params=params, data=gzip.compress(json_string), auth=self._auth())
    else:
        result = requests.put(self._documents_url(), headers=headers, params=params, json=new_doc, auth=self._auth())
    result = json.loads(_finish_response(result))
    if isinstance(document, list):
        for (idx, item) in enumerate(document):
            if (hasattr(item, '_obj_to_dict') and (not hasattr(item, '_backend_id'))):
                item._backend_id = result[idx][len('terminusdb:///data/'):]
    return result