This looks like a type mismatch to me. You're product and category IDs are being exported to the CSV file with quotes around them, making them strings. However the products_to_categories table needs them to be integers ......