comparison query_tabular.py @ 1:24f0911f75ee

Uploaded
author jjohnson
date Sat, 03 Oct 2015 09:23:08 -0400
parents 763c4f968dc6
children ffa5e34a55c1
comparison
equal deleted inserted replaced
0:763c4f968dc6 1:24f0911f75ee
101 print >> sys.stderr, 'Failed at line: %d err: %s' % (linenum,e) 101 print >> sys.stderr, 'Failed at line: %d err: %s' % (linenum,e)
102 conn.commit() 102 conn.commit()
103 c.close() 103 c.close()
104 except Exception, e: 104 except Exception, e:
105 print >> sys.stderr, 'Failed: %s' % (e) 105 print >> sys.stderr, 'Failed: %s' % (e)
106 exit(1)
106 107
107 def __main__(): 108 def __main__():
108 #Parse Command Line 109 #Parse Command Line
109 parser = optparse.OptionParser() 110 parser = optparse.OptionParser()
110 parser.add_option( '-s', '--sqlitedb', dest='sqlitedb', default=None, help='The SQLite Database' ) 111 parser.add_option( '-s', '--sqlitedb', dest='sqlitedb', default=None, help='The SQLite Database' )
173 for i,row in enumerate(results): 174 for i,row in enumerate(results):
174 # yield [val for val in row] 175 # yield [val for val in row]
175 outputFile.write("%s\n" % '\t'.join([str(val) for val in row])) 176 outputFile.write("%s\n" % '\t'.join([str(val) for val in row]))
176 except Exception, exc: 177 except Exception, exc:
177 print >> sys.stderr, "Error: %s" % exc 178 print >> sys.stderr, "Error: %s" % exc
179 exit(1)
178 180
179 if __name__ == "__main__": __main__() 181 if __name__ == "__main__": __main__()
180 182
181 183