Comment out index dropping for postgres--prevent hang.
This commit is contained in:
parent
66e734588c
commit
bc2277af74
|
@ -156,12 +156,16 @@ def prepareBulkImport(fdb):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
elif fdb.backend == PGSQL:
|
elif fdb.backend == PGSQL:
|
||||||
print "dropping pg fk", fk['fktab'], fk['fkcol']
|
# DON'T FORGET TO RECREATE THEM!!
|
||||||
try:
|
print "Index dropping disabled for postgresql."
|
||||||
fdb.cursor.execute("alter table " + fk['fktab'] + " drop constraint "
|
# print "dropping pg fk", fk['fktab'], fk['fkcol']
|
||||||
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey')
|
# try:
|
||||||
except:
|
# fdb.cursor.execute("alter table " + fk['fktab'] + " drop constraint "
|
||||||
pass
|
# + fk['fktab'] + '_' + fk['fkcol'] + '_fkey')
|
||||||
|
# print "alter table " + fk['fktab'] + " drop constraint " \
|
||||||
|
# + fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
|
||||||
|
# except:
|
||||||
|
# pass
|
||||||
else:
|
else:
|
||||||
print "Only MySQL and Postgres supported so far"
|
print "Only MySQL and Postgres supported so far"
|
||||||
return -1
|
return -1
|
||||||
|
@ -175,12 +179,17 @@ def prepareBulkImport(fdb):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
elif fdb.backend == PGSQL:
|
elif fdb.backend == PGSQL:
|
||||||
print "dropping pg index ", idx['tab'], idx['col']
|
# DON'T FORGET TO RECREATE THEM!!
|
||||||
# mod to use tab_col for index name?
|
print "Index dropping disabled for postgresql."
|
||||||
try:
|
# print "dropping pg index ", idx['tab'], idx['col']
|
||||||
fdb.cursor.execute( "drop index %s_%s_idx" % (idx['tab'],idx['col']) )
|
# # mod to use tab_col for index name?
|
||||||
except:
|
# try:
|
||||||
pass
|
# pass
|
||||||
|
# print "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']
|
||||||
|
# except:
|
||||||
|
# pass
|
||||||
else:
|
else:
|
||||||
print "Only MySQL and Postgres supported so far"
|
print "Only MySQL and Postgres supported so far"
|
||||||
return -1
|
return -1
|
||||||
|
@ -219,14 +228,19 @@ def afterBulkImport(fdb):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
elif fdb.backend == PGSQL:
|
elif fdb.backend == PGSQL:
|
||||||
print "creating fk ", fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
|
||||||
try:
|
|
||||||
fdb.cursor.execute("alter table " + fk['fktab'] + " add constraint "
|
|
||||||
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
|
|
||||||
+ " foreign key (" + fk['fkcol']
|
|
||||||
+ ") references " + fk['rtab'] + "(" + fk['rcol'] + ")")
|
|
||||||
except:
|
|
||||||
pass
|
pass
|
||||||
|
# print "creating fk ", fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||||
|
# try:
|
||||||
|
# print "alter table " + fk['fktab'] + " add constraint " \
|
||||||
|
# + fk['fktab'] + '_' + fk['fkcol'] + '_fkey' \
|
||||||
|
# + " foreign key (" + fk['fkcol'] \
|
||||||
|
# + ") references " + fk['rtab'] + "(" + fk['rcol'] + ")"
|
||||||
|
# fdb.cursor.execute("alter table " + fk['fktab'] + " add constraint "
|
||||||
|
# + fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
|
||||||
|
# + " foreign key (" + fk['fkcol']
|
||||||
|
# + ") references " + fk['rtab'] + "(" + fk['rcol'] + ")")
|
||||||
|
# except:
|
||||||
|
# pass
|
||||||
else:
|
else:
|
||||||
print "Only MySQL and Postgres supported so far"
|
print "Only MySQL and Postgres supported so far"
|
||||||
return -1
|
return -1
|
||||||
|
@ -241,15 +255,16 @@ def afterBulkImport(fdb):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
elif fdb.backend == PGSQL:
|
elif fdb.backend == PGSQL:
|
||||||
# mod to use tab_col for index name?
|
|
||||||
print "creating pg index ", idx['tab'], idx['col']
|
|
||||||
try:
|
|
||||||
print "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
|
||||||
fdb.cursor.execute( "create index %s_%s_idx on %s(%s)"
|
|
||||||
% (idx['tab'], idx['col'], idx['tab'], idx['col']) )
|
|
||||||
except:
|
|
||||||
print " ERROR! :-("
|
|
||||||
pass
|
pass
|
||||||
|
# # mod to use tab_col for index name?
|
||||||
|
# print "creating pg index ", idx['tab'], idx['col']
|
||||||
|
# try:
|
||||||
|
# print "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
||||||
|
# fdb.cursor.execute( "create index %s_%s_idx on %s(%s)"
|
||||||
|
# % (idx['tab'], idx['col'], idx['tab'], idx['col']) )
|
||||||
|
# except:
|
||||||
|
# print " ERROR! :-("
|
||||||
|
# pass
|
||||||
else:
|
else:
|
||||||
print "Only MySQL and Postgres supported so far"
|
print "Only MySQL and Postgres supported so far"
|
||||||
return -1
|
return -1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user