Mercurial > repos > jjohnson > query_tabular
diff query_db.py @ 22:bed5018e7ae3 draft
Uploaded
author | jjohnson |
---|---|
date | Mon, 17 Jul 2017 15:22:04 -0400 |
parents | 357fe86f245d |
children |
line wrap: on
line diff
--- a/query_db.py Fri Jul 14 17:34:22 2017 -0400 +++ b/query_db.py Mon Jul 17 15:22:04 2017 -0400 @@ -43,16 +43,16 @@ tables_query = TABLE_QUERY rslt = c.execute(tables_query).fetchall() for table, sql in rslt: - print("Table %s:" % table, file=sys.stderr) + print("Table %s:" % table, file=outputFile) try: col_query = 'SELECT * FROM %s LIMIT 0' % table cur = conn.cursor().execute(col_query) cols = [col[0] for col in cur.description] - print(" Columns: %s" % cols, file=sys.stderr) + print(" Columns: %s" % cols, file=outputFile) except Exception as exc: - print("Error: %s" % exc, file=sys.stderr) - except Exception as exc: - print("Error: %s" % exc, file=sys.stderr) + print("Warning: %s" % exc, file=sys.stderr) + except Exception as e: + exit('Error: %s' % (e)) exit(0)