Mercurial Hosting > traffic-intelligence
diff python/storage.py @ 908:b297525b2cbf
added options to the prototype cluster algorithm, work in progress
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 26 Jun 2017 00:10:35 -0400 |
parents | 753a081989e2 |
children | cd038493f8c6 |
line wrap: on
line diff
--- a/python/storage.py Fri Jun 23 23:50:02 2017 -0400 +++ b/python/storage.py Mon Jun 26 00:10:35 2017 -0400 @@ -19,6 +19,10 @@ 'car':2, 'truck':3} +tableNames = {'feature':'positions', + 'object': 'objects', + 'objectfeatures': 'positions'} + ######################### # Sqlite ######################### @@ -411,6 +415,9 @@ else: dbfn = filename cursor.execute('INSERT INTO prototypes (id, dbfilename, trajectory_type, nMatchings) VALUES ({},\"{}\",\"{}\",{})'.format(protoId, dbfn, trajectoryType, n)) + cursor.execute('SELECT * from sqlite_master WHERE type = \"table\" and name = \"{}\"'.format(tableNames[trajectoryType])) + if len(cursor.fetchall) == 0: + pass # save prototype trajectory data except sqlite3.OperationalError as error: printDBError(error) connection.commit()