Fix empty array in to_sql method