title: Pandas ignores dtype in function to_sql, giving TypeError: expecting string or bytes object
body: <p>I'm processing data from an Excel spreadsheet and uploading it to Oracle. Pandas fails on the command to_sql with a certain edge case. I have a particular column COMMENTS which usually contains strings, however in one row a user typed a number (i.e. 500). </p>
  
  <p>I am forcing it to read as a number using the dtype argument so I would expect the number to be uploaded to the Oracle table as a VARCHAR:</p>
  
  <pre><code>dataWrite.to_sql(name = 'FB_DATA_HOURLY', schema = 'schemaName', index = False, con = conWrite, if_exists='append', dtype={'COMMENTS': VARCHAR(length=200)})
  </code></pre>
  
  <p>However there is still a TypeError as it tries to upload this number to the VARCHAR column.</p>
  
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-99-1864db124148&gt; in readExcel_05142019(version, filepath)
       72     conWrite = oracle_db.connect()
  ---&gt; 73     dataWrite.to_sql(name = 'FB_DATA_HOURLY', schema = 'schemaName', index = False, con = conWrite, if_exists='append', dtype={'COMMENTS': VARCHAR(length=200)})
       74 
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\generic.py in to_sql(self, name, con, schema, if_exists, index, index_label, chunksize, dtype, method)
     2710             chunksize=chunksize,
     2711             dtype=dtype,
  -&gt; 2712             method=method,
     2713         )
     2714 
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py in to_sql(frame, name, con, schema, if_exists, index, index_label, chunksize, dtype, method)
      516         chunksize=chunksize,
      517         dtype=dtype,
  --&gt; 518         method=method,
      519     )
      520 
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py in to_sql(self, frame, name, if_exists, index, index_label, schema, chunksize, dtype, method)
     1318         )
     1319         table.create()
  -&gt; 1320         table.insert(chunksize, method=method)
     1321         if not name.isdigit() and not name.islower():
     1322             # check for potentially case sensitivity issues (GH7815)
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py in insert(self, chunksize, method)
      754 
      755                 chunk_iter = zip(*[arr[start_i:end_i] for arr in data_list])
  --&gt; 756                 exec_insert(conn, keys, chunk_iter)
      757 
      758     def _query_iterator(
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py in _execute_insert(self, conn, keys, data_iter)
      668         """
      669         data = [dict(zip(keys, row)) for row in data_iter]
  --&gt; 670         conn.execute(self.table.insert(), data)
      671 
      672     def _execute_insert_multi(self, conn, keys, data_iter):
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\base.py in execute(self, object_, *multiparams, **params)
      980             raise exc.ObjectNotExecutableError(object_)
      981         else:
  --&gt; 982             return meth(self, multiparams, params)
      983 
      984     def _execute_function(self, func, multiparams, params):
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\sql\elements.py in _execute_on_connection(self, connection, multiparams, params)
      285     def _execute_on_connection(self, connection, multiparams, params):
      286         if self.supports_execution:
  --&gt; 287             return connection._execute_clauseelement(self, multiparams, params)
      288         else:
      289             raise exc.ObjectNotExecutableError(self)
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _execute_clauseelement(self, elem, multiparams, params)
     1099             distilled_params,
     1100             compiled_sql,
  -&gt; 1101             distilled_params,
     1102         )
     1103         if self._has_events or self.engine._has_events:
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _execute_context(self, dialect, constructor, statement, parameters, *args)
     1248         except BaseException as e:
     1249             self._handle_dbapi_exception(
  -&gt; 1250                 e, statement, parameters, cursor, context
     1251             )
     1252 
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _handle_dbapi_exception(self, e, statement, parameters, cursor, context)
     1476                 util.raise_from_cause(sqlalchemy_exception, exc_info)
     1477             else:
  -&gt; 1478                 util.reraise(*exc_info)
     1479 
     1480         finally:
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\util\compat.py in reraise(tp, value, tb, cause)
      151         if value.__traceback__ is not tb:
      152             raise value.with_traceback(tb)
  --&gt; 153         raise value
      154 
      155     def u(s):
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _execute_context(self, dialect, constructor, statement, parameters, *args)
     1224                 if not evt_handled:
     1225                     self.dialect.do_executemany(
  -&gt; 1226                         cursor, statement, parameters, context
     1227                     )
     1228             elif not parameters and context.no_parameters:
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\sqlalchemy\dialects\oracle\cx_oracle.py in do_executemany(self, cursor, statement, parameters, context)
     1126         if isinstance(parameters, tuple):
     1127             parameters = list(parameters)
  -&gt; 1128         cursor.executemany(statement, parameters)
     1129 
     1130     def do_begin_twophase(self, connection, xid):
  
  TypeError: expecting string or bytes object
  </code></pre>