More sensible prints when dropping psql indexes

This commit is contained in:
Matt Turnbull 2009-03-21 17:46:16 +00:00
parent 239330ae7b
commit 50f775e793

View File

@ -157,12 +157,13 @@ def prepareBulkImport(fdb):
pass pass
elif fdb.backend == PGSQL: elif fdb.backend == PGSQL:
# DON'T FORGET TO RECREATE THEM!! # DON'T FORGET TO RECREATE THEM!!
print "dropping pg fk", fk['fktab'], fk['fkcol'] #print "dropping pg fk", fk['fktab'], fk['fkcol']
try: try:
fdb.cursor.execute("alter table " + fk['fktab'] + " drop constraint " fdb.cursor.execute("alter table " + fk['fktab'] + " drop constraint "
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey') + fk['fktab'] + '_' + fk['fkcol'] + '_fkey')
print "dropped pg fk pg fk %s_%s_fkey" % (fk['fktab'], fk['fkcol'])
except: except:
pass print "! failed drop pg fk %s_%s_fkey" % (fk['fktab'], fk['fkcol'])
else: else:
print "Only MySQL and Postgres supported so far" print "Only MySQL and Postgres supported so far"
return -1 return -1
@ -177,15 +178,15 @@ def prepareBulkImport(fdb):
pass pass
elif fdb.backend == PGSQL: elif fdb.backend == PGSQL:
# DON'T FORGET TO RECREATE THEM!! # DON'T FORGET TO RECREATE THEM!!
print "Index dropping disabled for postgresql." #print "Index dropping disabled for postgresql."
print "dropping pg index ", idx['tab'], idx['col'] #print "dropping pg index ", idx['tab'], idx['col']
# mod to use tab_col for index name? # mod to use tab_col for index name?
try: try:
print "drop index %s_%s_idx" % (idx['tab'],idx['col'])
fdb.cursor.execute( "drop index %s_%s_idx" % (idx['tab'],idx['col']) ) fdb.cursor.execute( "drop index %s_%s_idx" % (idx['tab'],idx['col']) )
print "dropped pg index ", idx['tab'], idx['col'] print "drop index %s_%s_idx" % (idx['tab'],idx['col'])
#print "dropped pg index ", idx['tab'], idx['col']
except: except:
pass print "! failed drop index %s_%s_idx" % (idx['tab'],idx['col'])
else: else:
print "Only MySQL and Postgres supported so far" print "Only MySQL and Postgres supported so far"
return -1 return -1