|
@@ -102,9 +102,9 @@ db_results_decode_pandas(results2, vettSpec)
|
|
|
print(time.time() - timestamp0)
|
|
|
|
|
|
|
|
|
-with open('DeResult.json', 'w') as file1:
|
|
|
- results2Dict = json.loads(results2.to_json(orient='records'))
|
|
|
- json.dump(results2Dict, file1, indent=2)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
timestamp0 = time.time()
|
|
@@ -142,10 +142,8 @@ with sqlite3.connect(f"file:{dbFile}?mode=ro", uri=True) as connection:
|
|
|
cur = connection.cursor()
|
|
|
for index, row in results2Simp2.iterrows():
|
|
|
ntx = row['ntx']
|
|
|
- indlem = row['indlem']
|
|
|
prevMappa = row['mappa'] - 15
|
|
|
- nextMappa = row['mappa'] + 15
|
|
|
- cur.execute(f'SELECT prev_tab.pitxt AS piniz FROM Occ00001 AS prev_tab, periodi WHERE prev_tab.ntx = {ntx} AND prev_tab.indlem = {indlem} AND prev_tab.mappa = {prevMappa}')
|
|
|
+ cur.execute(f'SELECT prev_tab.pitxt AS piniz FROM Occ00001 AS prev_tab WHERE prev_tab.ntx = {ntx} AND prev_tab.mappa = {prevMappa}')
|
|
|
res = cur.fetchone()
|
|
|
piniz.append(res[0] if res is not None else None)
|
|
|
|
|
@@ -154,14 +152,12 @@ print(time.time() - timestamp0)
|
|
|
timestamp0 = time.time()
|
|
|
with sqlite3.connect(f"file:{dbFile}?mode=ro", uri=True) as connection:
|
|
|
tmpQuery = theQuerySimp2(','.join(codesStr), ','.join(formCodesStr))
|
|
|
+ querr = 'CREATE TEMPORARY TABLE stuff AS ' + tmpQuery
|
|
|
+ connection.execute(querr)
|
|
|
+ riQuery = "SELECT * FROM stuff LEFT JOIN Occ00001 AS prev_tab ON prev_tab.ntx = stuff.ntx AND prev_tab.mappa = stuff.mappa - 15"
|
|
|
results2Simp2 = pd.read_sql(tmpQuery, connection)
|
|
|
- piniz = []
|
|
|
- strList = []
|
|
|
- for index, row in results2Simp2.iterrows():
|
|
|
- ntx = row['ntx']
|
|
|
- prevMappa = row['mappa'] - 15
|
|
|
- strList.append( f'(prev_tab.ntx = {ntx} AND prev_tab.mappa = {prevMappa})' )
|
|
|
- pazzi = '(' + ' OR '.join(strList) + ')'
|
|
|
+
|
|
|
+print(time.time() - timestamp0)
|
|
|
|
|
|
with sqlite3.connect(f"file:{dbFile}?mode=ro", uri=True) as connection:
|
|
|
cur = connection.cursor()
|