+ def get_version(self):
+ """Returns the database format version
+
+ :returns: The database version as positive integer
+ :exception: :exc:`NotmuchError` with STATUS.NOT_INITIALIZED if
+ the database was not intitialized.
+ """
+ if self._db is None:
+ raise NotmuchError(STATUS.NOT_INITIALIZED)
+
+ return Database._get_version (self._db)
+
+ def needs_upgrade(self):
+ """Does this database need to be upgraded before writing to it?
+
+ If this function returns TRUE then no functions that modify the
+ database (:meth:`Database.add_message`, :meth:`Database.add_tag`,
+ :meth:`Directory.set_mtime`, etc.) will work unless :meth:`upgrade`
+ is called successfully first.
+
+ :returns: `True` or `False`
+ :exception: :exc:`NotmuchError` with STATUS.NOT_INITIALIZED if
+ the database was not intitialized.
+ """
+ if self._db is None:
+ raise NotmuchError(STATUS.NOT_INITIALIZED)
+
+ return notmuch_database_needs_upgrade(self.db)
+