renamed export_table to export for readability
added reconnect for db