Put index dropping back in for postgres.
This commit is contained in:
parent
466f6c09c2
commit
48c2c36de6
|
@ -157,15 +157,12 @@ 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 "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')
|
except:
|
||||||
# print "alter table " + fk['fktab'] + " drop constraint " \
|
pass
|
||||||
# + 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
|
||||||
|
@ -181,15 +178,14 @@ def prepareBulkImport(fdb):
|
||||||
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:
|
||||||
# pass
|
print "drop index %s_%s_idx" % (idx['tab'],idx['col'])
|
||||||
# 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 "dropped pg index ", idx['tab'], idx['col']
|
except:
|
||||||
# except:
|
pass
|
||||||
# pass
|
|
||||||
else:
|
else:
|
||||||
print "Only MySQL and Postgres supported so far"
|
print "Only MySQL and Postgres supported so far"
|
||||||
return -1
|
return -1
|
||||||
|
@ -228,19 +224,14 @@ 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
|
||||||
|
@ -255,16 +246,16 @@ def afterBulkImport(fdb):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
elif fdb.backend == PGSQL:
|
elif fdb.backend == PGSQL:
|
||||||
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
|
# 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