pyLodStorage 0.2.1__tar.gz → 0.2.2__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.
Files changed (38) hide show
  1. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/PKG-INFO +1 -1
  2. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/sql.py +20 -5
  3. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/trulytabular.py +9 -2
  4. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/version.py +2 -2
  5. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/PKG-INFO +1 -1
  6. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/trulytabular.yaml +1 -1
  7. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/LICENSE +0 -0
  8. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/README.md +0 -0
  9. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/csv.py +0 -0
  10. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/entity.py +0 -0
  11. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/jsonable.py +0 -0
  12. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/jsonpicklemixin.py +0 -0
  13. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/lod.py +0 -0
  14. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/mwTable.py +0 -0
  15. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/plot.py +0 -0
  16. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/query.py +0 -0
  17. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/querymain.py +0 -0
  18. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/sample.py +0 -0
  19. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/schema.py +0 -0
  20. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/sparql.py +0 -0
  21. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/storageconfig.py +0 -0
  22. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/tabulateCounter.py +0 -0
  23. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/uml.py +0 -0
  24. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/yamlablemixin.py +0 -0
  25. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/SOURCES.txt +0 -0
  26. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/dependency_links.txt +0 -0
  27. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/entry_points.txt +0 -0
  28. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/requires.txt +0 -0
  29. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/top_level.txt +0 -0
  30. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/__init__.py +0 -0
  31. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/endpoints.yaml +0 -0
  32. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/formats.yaml +0 -0
  33. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/queries.yaml +0 -0
  34. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/scholia.yaml +0 -0
  35. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/wf.yaml +0 -0
  36. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/wikidata.yaml +0 -0
  37. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/setup.cfg +0 -0
  38. {pylodstorage-0.2.1 → pylodstorage-0.2.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylodstorage
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -173,9 +173,9 @@ class SQLDB(object):
173
173
  msg="%s\nfailed:%s%s" % (insertCmd,str(ex),debugInfo)
174
174
  raise Exception(msg)
175
175
 
176
- def query(self,sqlQuery,params=None):
176
+ def queryGen(self,sqlQuery,params=None):
177
177
  '''
178
- run the given sqlQuery and return a list of Dicts
178
+ run the given sqlQuery a a generator for dicts
179
179
 
180
180
  Args:
181
181
 
@@ -183,7 +183,7 @@ class SQLDB(object):
183
183
  params(tuple): the query params, if any
184
184
 
185
185
  Returns:
186
- list: a list of Dicts
186
+ a generator of dicts
187
187
  '''
188
188
  if self.debug:
189
189
  print(sqlQuery)
@@ -196,17 +196,32 @@ class SQLDB(object):
196
196
  else:
197
197
  query = cur.execute(sqlQuery)
198
198
  colname = [ d[0] for d in query.description ]
199
- resultList=[]
200
199
  try:
201
200
  # loop over all rows
202
201
  for row in query:
203
202
  record=dict(zip(colname, row))
204
- resultList.append(record)
203
+ yield record
205
204
  except Exception as ex:
206
205
  msg=str(ex)
207
206
  self.logError(msg)
208
207
  pass
209
208
  cur.close()
209
+
210
+ def query(self,sqlQuery,params=None):
211
+ '''
212
+ run the given sqlQuery and return a list of Dicts
213
+
214
+ Args:
215
+
216
+ sqlQuery(string): the SQL query to be executed
217
+ params(tuple): the query params, if any
218
+
219
+ Returns:
220
+ list: a list of Dicts
221
+ '''
222
+ resultList=[]
223
+ for record in self.queryGen(sqlQuery, params):
224
+ resultList.append(record)
210
225
  return resultList
211
226
 
212
227
  def queryAll(self,entityInfo,fixDates=True):
@@ -323,13 +323,20 @@ WHERE
323
323
  return qm
324
324
  return None
325
325
 
326
- def mostFrequentPropertiesQuery(self):
326
+ def mostFrequentPropertiesQuery(self,whereClause:str=None):
327
327
  '''
328
328
  get the most frequently used properties
329
+
330
+ Args:
331
+ whereClause(str): an extra WhereClause to use
329
332
  '''
330
333
  query=self.queryManager.queriesByName["mostFrequentProperties"]
334
+ if whereClause is None:
335
+ whereClause=f"?item wdt:P31 wd:{self.itemQid};";
336
+ else:
337
+ whereClause+=";"
331
338
  query.title=f"most frequently used properties for {self.asText(long=True)}"
332
- query.query=query.query % (self.item.asText(long=True),self.itemQid,self.lang)
339
+ query.query=query.query % (self.item.asText(long=True),whereClause,self.lang)
333
340
  return query
334
341
 
335
342
  def noneTabularQuery(self,wdProperty:WikidataProperty,asFrequency:bool=True):
@@ -9,6 +9,6 @@ class Version(object):
9
9
  Version handling for pyLoDStorage
10
10
  '''
11
11
  name="pylodstorage"
12
- version='0.2.1'
12
+ version='0.2.2'
13
13
  date = '2020-09-10'
14
- updated = '2022-03-27'
14
+ updated = '2022-04-11'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylodstorage
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -10,7 +10,7 @@
10
10
  {
11
11
  SELECT ?prop (COUNT(DISTINCT ?item) AS ?count) WHERE {
12
12
  hint:Query hint:optimizer "None".
13
- ?item wdt:P31 wd:%s;
13
+ %s
14
14
  ?p ?id.
15
15
  ?prop wikibase:directClaim ?p.
16
16
  }
File without changes
File without changes
File without changes
File without changes