comparison load_db.py @ 22:bed5018e7ae3 draft

Uploaded
author jjohnson
date Mon, 17 Jul 2017 15:22:04 -0400
parents ab27c4bd14b9
children
comparison
equal deleted inserted replaced
21:357fe86f245d 22:bed5018e7ae3
120 print('Failed at line: %d err: %s' % (linenum, e), 120 print('Failed at line: %d err: %s' % (linenum, e),
121 file=sys.stderr) 121 file=sys.stderr)
122 conn.commit() 122 conn.commit()
123 c.close() 123 c.close()
124 except Exception as e: 124 except Exception as e:
125 print('Failed: %s' % (e), file=sys.stderr) 125 exit('Error: %s' % (e))
126 exit(1)
127 126
128 127
129 def create_index(conn, table_name, index_name, index_columns, unique=False): 128 def create_index(conn, table_name, index_name, index_columns, unique=False):
130 index_def = "CREATE %s INDEX %s on %s(%s)" % ( 129 index_def = "CREATE %s INDEX %s on %s(%s)" % (
131 'UNIQUE' if unique else '', index_name, 130 'UNIQUE' if unique else '', index_name,