Premiere commit - Omika
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import sqlite3, json, collections, sys
|
||||
|
||||
db = r'C:\Users\Susana\AppData\Local\Omika\omika.db'
|
||||
con = sqlite3.connect(db)
|
||||
cur = con.cursor()
|
||||
tables = [r[0] for r in cur.execute("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name")]
|
||||
print('TABLES:', tables)
|
||||
for t in ['RendezVous', 'Client', 'Collaborateur', 'Dossier', 'SuiviTemps', 'Intervention', 'Site']:
|
||||
try:
|
||||
n = cur.execute('SELECT COUNT(*) FROM "%s"' % t).fetchone()[0]
|
||||
print('%s: %d rows' % (t, n))
|
||||
except Exception as e:
|
||||
print('%s: ERR %s' % (t, e))
|
||||
print()
|
||||
rows = cur.execute('SELECT Id, PayloadJson, UpdatedAtUtc FROM RendezVous LIMIT 2').fetchall()
|
||||
print('SAMPLE RendezVous rows:')
|
||||
for r in rows:
|
||||
print(' Id=', r[0], 'Updated=', r[2])
|
||||
print(' Payload=', r[1][:500])
|
||||
print()
|
||||
dates = []
|
||||
parse_errors = 0
|
||||
for (Id, PayloadJson, UpdatedAtUtc) in cur.execute('SELECT Id, PayloadJson, UpdatedAtUtc FROM RendezVous'):
|
||||
try:
|
||||
d = json.loads(PayloadJson)
|
||||
dates.append((d.get('Debut'), d.get('Fin'), d.get('Titre')))
|
||||
except Exception as e:
|
||||
parse_errors += 1
|
||||
dates.append(('PARSE_ERR:' + str(e), None, None))
|
||||
print('TOTAL RendezVous payloads:', len(dates), 'parse_errors:', parse_errors)
|
||||
if dates:
|
||||
counts = collections.Counter((x[0] or 'None')[:10] for x in dates)
|
||||
print('Debut distribution (date prefix):', dict(sorted(counts.items())))
|
||||
valid = [x[0] for x in dates if isinstance(x[0], str)]
|
||||
if valid:
|
||||
print('Min Debut:', min(valid))
|
||||
print('Max Debut:', max(valid))
|
||||
print('Sample entries:')
|
||||
for x in dates[:15]:
|
||||
print(' ', x)
|
||||
con.close()
|
||||
Reference in New Issue
Block a user