# Data Export and Import in Python

> The following APIs save a database image snapshot or class data to the specified external file. Also APIs are provided to perform incremental online backup . (See the Incremental Backup and Restore page for further details.)

> ## Database snapshots

> To save an image of an in-memory database (transient objects) to a specified file, the Connection class provides method `saveSnapshot()`. (A file is always created, or overwritten if it exists). The method signature is:

>         public boolean saveSnapshot(path, saveMetadata=True, saveCRC=True)

> ## Saving and Loading individual classes

> It is sometimes desirable to export / import only data for an individual database class. The Connection class provides the following methods for this purpose:

>         public boolean saveClass(filePath, class)

>         public boolean loadClass(filePath, class = None, doMerge = False)

> Note that if the `doMerge` argument is `False`, the existing data content of this class is cleared before loading from the image file. If `True` the loaded objects are "added" to the class. The methods return `True` if the objects were successfully saved or loaded, `False` if the specified file can not be opened.