diff options
| author | leonoverweel <l.overweel@gmail.com> | 2017-02-27 02:14:04 +0100 |
|---|---|---|
| committer | leonoverweel <l.overweel@gmail.com> | 2017-02-27 02:14:04 +0100 |
| commit | 8e2c8d669aa547cf8749fa774160f4d05fff121a (patch) | |
| tree | d1edff428474ba44ac7c196f9cba43386fc8e285 | |
| parent | 5990c005edb42a5e064224a03fed32522a66047e (diff) | |
Add Python script to view a table in the db
| -rw-r--r-- | database/view-table.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/database/view-table.py b/database/view-table.py new file mode 100644 index 00000000..615b4081 --- /dev/null +++ b/database/view-table.py @@ -0,0 +1,17 @@ +import os +import sqlite3 +import sys + +try: + BASE_DIR = directory_name=sys.argv[1] +except: + BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +db_location = os.path.join(BASE_DIR, 'opendc.db') + +conn = sqlite3.connect(db_location) +c = conn.cursor() + +rows = c.execute('SELECT * FROM ' + sys.argv[2]) + +for row in rows: + print row |
