title: Trying to build dtype input dictionary for pandas .to_sql dynamically
body: <p>I am trying to use the dataframe column max string lengths to build the something like this:</p>
  <pre><code>dtype={'column1' : sqlalchemy.types.VARCHAR(5000),
         'column2' : sqlalchemy.types.VARCHAR(5000),
         'column3' : sqlalchemy.types.VARCHAR(25000)
        }
  </code></pre>
  <p>I have tried a couple of different ways:</p>
  <pre><code>str_length = (dict([(v, task_merge[v].apply(lambda r: len(str(r)) if r!=None else 0).max())for v in task_merge.columns.values]))
  </code></pre>
  <p>That part works to give me a dictionary of all the string max length.</p>
  <p>Here is the part that is not working to add the sqlalchemy.types.VARCHAR() to them:</p>
  <pre><code>db_dict = {f'sqlalchemy.types.VARCHAR({v})' : v for k, v in str_length.items()}
  </code></pre>
  <p>Results in &quot;The type of sqlalchemy.types.VARCHAR(8) is not a SQLAlchemy type&quot;</p>
  <pre><code>db_dict = {sqlalchemy.types.VARCHAR(v) : v for k, v in str_length.items()}
  </code></pre>
  <p>Reults in &quot;The type of VARCHAR(8) is not a SQLAlchemy type&quot;</p>
  <pre><code>db_dict = {'''sqlalchemy.types.VARCHAR({v})''' : v for k, v in str_length.items()}
  </code></pre>
  <p>Reults in &quot;The type of VARCHAR(8) is not a SQLAlchemy type&quot;</p>
  <p>Anyone have any ideas on how to do this?</p>