def rename_tables_with_constraints(renames, constraints, engine):
 if (engine.name != 'sqlite'):
  remove_constraints(constraints)
 for to_table_name in renames:
  from_table = renames[to_table_name]
  from_table.rename(to_table_name)
 if (engine != 'sqlite'):
  add_constraints(constraints)

def rename_tables_with_constraints ( renames , constraints , engine ) : if ( engine . name != 'sqlite' ) : remove_constraints ( constraints ) for to_table_name in renames : from_table = renames [ to_table_name ] from_table . rename ( to_table_name ) if ( engine != 'sqlite' ) : add_constraints ( constraints )
rename tables with foreign key constraints .