Fixed incorrect datatype conversion on multi-indexes

When creating a new table from a `pandas` dataframe with a multi-index, the code would iterate over the index columns backwards but use their types as if counting forwards.  This meant that the created table had incorrect indexes for multi-indexes.

This code factors out a function to pull column names and column types for both SQLAlchemy and legacy table objects.  This code now iterates over the indices properly.

And additional test has been written.  All test pass on my local machine.

Closes https://github.com/pydata/pandas/issues/8021 .
Created a PR #8042 .