pyLodStorage 0.0.78__tar.gz → 0.0.79__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pylodstorage-0.0.78/pylodstorage.egg-info → pylodstorage-0.0.79}/PKG-INFO +1 -1
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/entity.py +15 -9
- {pylodstorage-0.0.78 → pylodstorage-0.0.79/pylodstorage.egg-info}/PKG-INFO +1 -1
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/setup.py +1 -1
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/LICENSE +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/README.md +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/__init__.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/csv.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/jsonable.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/jsonpicklemixin.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/lod.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/mwTable.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/plot.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/query.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/sample.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/schema.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/sparql.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/sql.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/storageconfig.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/tabulateCounter.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/uml.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/lodstorage/yamlablemixin.py +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/pylodstorage.egg-info/SOURCES.txt +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/pylodstorage.egg-info/dependency_links.txt +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/pylodstorage.egg-info/requires.txt +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/pylodstorage.egg-info/top_level.txt +0 -0
- {pylodstorage-0.0.78 → pylodstorage-0.0.79}/setup.cfg +0 -0
|
@@ -167,14 +167,14 @@ GROUP by ?source
|
|
|
167
167
|
raise Exception("unsupported mode %s" % self.mode)
|
|
168
168
|
return result
|
|
169
169
|
|
|
170
|
-
def fromCache(self,force:bool=False,getListOfDicts=None,
|
|
170
|
+
def fromCache(self,force:bool=False,getListOfDicts=None,append=False,sampleRecordCount=-1):
|
|
171
171
|
'''
|
|
172
172
|
get my entries from the cache or from the callback provided
|
|
173
173
|
|
|
174
174
|
Args:
|
|
175
175
|
force(bool): force ignoring the cache
|
|
176
176
|
getListOfDicts(callable): a function to call for getting the data
|
|
177
|
-
|
|
177
|
+
append(bool): True if records should be appended
|
|
178
178
|
sampleRecordCount(int): the number of records to analyze for type information
|
|
179
179
|
|
|
180
180
|
Returns:
|
|
@@ -191,7 +191,7 @@ GROUP by ?source
|
|
|
191
191
|
listOfDicts=getListOfDicts()
|
|
192
192
|
duration=time.time()-startTime
|
|
193
193
|
self.showProgress(f"got {len(listOfDicts)} {self.entityPluralName} in {duration:5.1f} s")
|
|
194
|
-
self.cacheFile=self.storeLoD(listOfDicts,
|
|
194
|
+
self.cacheFile=self.storeLoD(listOfDicts,append=append,sampleRecordCount=sampleRecordCount)
|
|
195
195
|
self.setListFromLoD(listOfDicts)
|
|
196
196
|
else:
|
|
197
197
|
# fromStore also sets self.cacheFile
|
|
@@ -270,14 +270,14 @@ SELECT ?eventId ?acronym ?series ?title ?year ?country ?city ?startDate ?endDate
|
|
|
270
270
|
lod.append(entity.__dict__)
|
|
271
271
|
return lod
|
|
272
272
|
|
|
273
|
-
def store(self,limit=10000000,batchSize=250,
|
|
273
|
+
def store(self,limit=10000000,batchSize=250,append=False,fixNone=True,sampleRecordCount=-1)->str:
|
|
274
274
|
'''
|
|
275
275
|
store my list of dicts
|
|
276
276
|
|
|
277
277
|
Args:
|
|
278
278
|
limit(int): maximum number of records to store per batch
|
|
279
279
|
batchSize(int): size of batch for storing
|
|
280
|
-
|
|
280
|
+
append(bool): True if records should be appended
|
|
281
281
|
fixNone(bool): if True make sure the dicts are filled with None references for each record
|
|
282
282
|
sampleRecordCount(int): the number of records to analyze for type information
|
|
283
283
|
|
|
@@ -285,9 +285,9 @@ SELECT ?eventId ?acronym ?series ?title ?year ?country ?city ?startDate ?endDate
|
|
|
285
285
|
str: The cachefile being used
|
|
286
286
|
'''
|
|
287
287
|
lod=self.getLoD()
|
|
288
|
-
return self.storeLoD(lod,limit=limit,batchSize=batchSize,
|
|
288
|
+
return self.storeLoD(lod,limit=limit,batchSize=batchSize,append=append,fixNone=fixNone,sampleRecordCount=sampleRecordCount)
|
|
289
289
|
|
|
290
|
-
def storeLoD(self,listOfDicts,limit=10000000,batchSize=250,cacheFile=None,
|
|
290
|
+
def storeLoD(self,listOfDicts,limit=10000000,batchSize=250,cacheFile=None,append=False,fixNone=True,sampleRecordCount=1)->str:
|
|
291
291
|
'''
|
|
292
292
|
store my entities
|
|
293
293
|
|
|
@@ -296,7 +296,7 @@ SELECT ?eventId ?acronym ?series ?title ?year ?country ?city ?startDate ?endDate
|
|
|
296
296
|
limit(int): maximum number of records to store
|
|
297
297
|
batchSize(int): size of batch for storing
|
|
298
298
|
cacheFile(string): the name of the storage e.g path to JSON or sqlite3 file
|
|
299
|
-
|
|
299
|
+
append(bool): True if records should be appended
|
|
300
300
|
fixNone(bool): if True make sure the dicts are filled with None references for each record
|
|
301
301
|
sampleRecordCount(int): the number of records to analyze for type information
|
|
302
302
|
|
|
@@ -331,7 +331,13 @@ SELECT ?eventId ?acronym ?series ?title ?year ?country ?city ?startDate ?endDate
|
|
|
331
331
|
cacheFile=self.getCacheFile(config=self.config,mode=self.config.mode)
|
|
332
332
|
sqldb=self.getSQLDB(cacheFile)
|
|
333
333
|
self.showProgress ("storing %d %s for %s to %s:%s" % (len(listOfDicts),self.entityPluralName,self.name,config.mode,cacheFile))
|
|
334
|
-
|
|
334
|
+
if append:
|
|
335
|
+
withDrop=False
|
|
336
|
+
withCreate=False
|
|
337
|
+
else:
|
|
338
|
+
withDrop=True
|
|
339
|
+
withCreate=True
|
|
340
|
+
entityInfo=sqldb.createTable(listOfDicts, self.tableName, primaryKey=self.primaryKey,withCreate=withCreate,withDrop=withDrop,sampleRecordCount=sampleRecordCount)
|
|
335
341
|
self.sqldb.store(listOfDicts, entityInfo,executeMany=self.executeMany,fixNone=fixNone)
|
|
336
342
|
self.showProgress ("store for %s done after %5.1f secs" % (self.name,time.time()-startTime))
|
|
337
343
|
else:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|