title: PyODBC SQL type error when reading query in Pandas
body: <p>Looking for some help with a specific error when I write out from a <code>pyodbc</code> connection. How do I fix the error:</p>
  
  <blockquote>
    <p>ODBC SQL type -360 is not yet supported. column-index=1 type=-360', 'HY106' error from PYODBC</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>import pyodbc
  import pandas as pd
  import sqlparse
  
  ## Function created to read SQL Query
  def create_query_string(sql_full_path):
      with open(sql_full_path, 'r') as f_in:
          lines = f_in.read()
  
      # remove any common leading whitespace from every line
      query_string = textwrap.dedent("""{}""".format(lines))
      ## remove comments from SQL Code
      query_string = sqlparse.format(query_string, strip_comments=True)
  
      return query_string
  
  query_string = create_query_string("Bad Code from R.sql")
  
  ## initializes the connection string
  curs = conn.cursor()
  
  df=pd.read_sql(query_string,conn)
  
  df.to_csv("TestSql.csv",index=None)
  </code></pre>
  
  <p>We are using the following SQL code in query string:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT loss_yr_qtr_cd, 
         CASE 
           WHEN loss_qtr_cd &lt;= 2 THEN loss_yr_num 
           ELSE loss_yr_num + 1 
         END                    AS LOSS_YR_ENDING, 
         snap_yr_qtr_cd, 
         CASE 
           WHEN snap_qtr_cd &lt;= 2 THEN snap_yr_num 
           ELSE snap_yr_num + 1 
         END                    AS CAL_YR_ENDING, 
         cur_ctstrph_loss_ind, 
         clm_symb_grp_cd, 
         adbfdb_pol_form_nm, 
         risk_st_nm, 
         wrt_co_nm, 
         wrt_co_part_cd, 
         src_of_bus_cd, 
         rt_zip_dlv_ofc_cd, 
         cur_rst_rt_terr_cd, 
         Sum(xtra_cntrc_py_amt) AS XTRA_CNTRC_PY_AMT 
  FROM   (SELECT DT.loss_yr_qtr_cd, 
                 DT.loss_qtr_cd, 
                 DT.loss_yr_num, 
                 SNAP.snap_yr_qtr_cd, 
                 SNAP.snap_qtr_cd, 
                 SNAP.snap_yr_num, 
                 CLM.cur_ctstrph_loss_ind, 
                 CLM.clm_symb_grp_cd, 
                 POL_SLCT.adbfdb_pol_form_nm, 
                 POL_SLCT.adbfdb_pol_form_cd, 
                 CVR.bsic_cvr_ind, 
                 POL_SLCT.priv_pass_ind, 
                 POL_SLCT.risk_st_nm, 
                 POL_SLCT.wrt_co_nm, 
                 POL_SLCT.wrt_co_part_cd, 
                 POL_SLCT.src_of_bus_cd, 
                 TERR.rt_zip_dlv_ofc_cd, 
                 TERR.cur_rst_rt_terr_cd, 
                 LOSS.xtra_cntrc_py_amt 
          FROM   ahshdm1d.vmaloss_day_dt_dim DT, 
                 ahshdm1d.vmasnap_yr_mo_dim SNAP, 
                 ahshdm1d.tmaaclm_dim CLM, 
                 ahshdm1d.tmaapol_slct_dim POL_SLCT, 
                 ahshdm1d.tmaacvr_dim CVR, 
                 ahshdm1d.tmaart_terr_dim TERR, 
                 ahshdm1d.tmaaloss_fct LOSS, 
                 ahshdm1d.tmaaprod_bus_dim BUS 
          WHERE  SNAP.snap_yr_qtr_cd BETWEEN '20083' AND '20182' 
                 AND TRIM(POL_SLCT.adbfdb_lob_cd) = 'A' 
                 AND CVR.bsic_cvr_ind = 'Y' 
                 AND POL_SLCT.priv_pass_ind = 'Y' 
                 AND POL_SLCT.adbfdb_pol_form_cd = 'V' 
                 AND POL_SLCT.src_of_bus_cd NOT IN ( 'ITC', 'INV' ) 
                 AND LOSS.xtra_cntrc_py_amt &gt; 0 
                 AND LOSS.loss_day_dt_id = DT.loss_day_dt_dim_id 
                 AND LOSS.cvr_dim_id = CVR.cvr_dim_id 
                 AND LOSS.pol_slct_dim_id = POL_SLCT.pol_slct_dim_id 
                 AND LOSS.rt_terr_dim_id = TERR.rt_terr_dim_id 
                 AND LOSS.prod_bus_dim_id = BUS.prod_bus_dim_id 
                 AND LOSS.clm_dim_id = CLM.clm_dim_id 
                 AND LOSS.snap_yr_mo_dt_id = SNAP.snap_yr_mo_dt_id) AS TABLE1 
  GROUP  BY loss_yr_qtr_cd, 
            loss_qtr_cd, 
            loss_yr_num, 
            snap_yr_qtr_cd, 
            snap_qtr_cd, 
            snap_yr_num, 
            cur_ctstrph_loss_ind, 
            clm_symb_grp_cd, 
            adbfdb_pol_form_nm, 
            risk_st_nm, 
            wrt_co_nm, 
            wrt_co_part_cd, 
            src_of_bus_cd, 
            rt_zip_dlv_ofc_cd, 
            cur_rst_rt_terr_cd 
  FOR FETCH only 
  </code></pre>
  
  <p>Just looking how to properly write out the database.</p>
  
  <p>Thanks,</p>
  
  <p>Justin</p>