ZODB.Architecture.Connection.importFile
Documentation
Import an object and all objects that were saved with it from an export file. The file must contain the string 'ZEXP' followed by a sequence of ExportFileRecords.
The imported objects are new objects. Existing objects are not updated. The imported objects are not even reachable from existing objects. It is necessary to hook the imported object into the existing object by fetching the new object using the object id returned and inserting the object into an object that is reachable.
Parameters
Type | Name | Default | Documentation |
PyObject | file | | either a file name or an object with a read method, as defined for Python file objects |
Returns
| | the object ID of the root object from the export file |
Example
def importAs(self, file, name):
�Import data in the given file and assign it as an attribute�
new_oid=self._p_jar.db().import(file)
new_object=self._p_jar[new_oid]
setattr(self, name, new_object)