[dataimport] Add a ``flush`` method for all stores.
For ``ObjectStore``, ``RQLObjectStore`` and ``NoHookRQLObjectStore``
the method tries to call the ``commit`` method.
For ``SQLGenObjectStore``, the ``flush`` method is basically
unchanged with respect to previous changesets.
--- a/dataimport.py Tue Apr 02 12:11:44 2013 +0200
+++ b/dataimport.py Tue Apr 02 12:12:41 2013 +0200
@@ -523,6 +523,18 @@
"""
pass
+ def flush(self):
+ """The method is provided so that all stores share a common API.
+ It just tries to call the commit method.
+ """
+ print 'starting flush'
+ try:
+ self.commit()
+ except:
+ print 'failed to flush'
+ else:
+ print 'flush done'
+
def rql(self, *args):
if self._rql is not None:
return self._rql(*args)
@@ -1010,6 +1022,8 @@
encoding=self.dbencoding)
except:
print 'failed to flush'
+ else:
+ print 'flush done'
finally:
_entities_sql.clear()
_relations_sql.clear()