Use the massive store for initial creation of concept schemes
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 14 Oct 2016 18:10:07 +0200
changeset 1842 ece22f65f9e5
parent 1841 488fb224e689
child 1843 4cec18e07edf
Use the massive store for initial creation of concept schemes when the instance's backend is postgres.
dataimport.py
--- a/dataimport.py	Thu Oct 13 23:05:40 2016 +0200
+++ b/dataimport.py	Fri Oct 14 18:10:07 2016 +0200
@@ -23,7 +23,6 @@
 
 from six import text_type
 
-from cubicweb.dataimport.stores import NoHookRQLObjectStore
 from cubicweb.dataimport.importer import SimpleImportLog
 
 from cubes.skos import lcsv, sobjects as skos
@@ -108,7 +107,12 @@
 
 def import_seda_schemes(cnx, lcsv_import=lcsv_import):
     """Import all LCSV data files defined in LCSV_FILES"""
-    store = NoHookRQLObjectStore(cnx)
+    if cnx.repo.system_source.dbdriver == 'postgres':
+        from cubicweb.dataimport.massive_store import MassiveObjectStore
+        store = MassiveObjectStore(cnx, eids_seq_range=1000)
+    else:
+        from cubicweb.dataimport.stores import NoHookRQLObjectStore
+        store = NoHookRQLObjectStore(cnx)
     for title, rtypes, etypes, fname in LCSV_FILES:
         if not cnx.find('ConceptScheme', title=title):
             print('importing', title.encode('utf-8'))