title: Encoding (?) issues fetching binary data (image type column) from SQL Server via pyodbc/Python3
body: <p>I need to access spectroscopic data (x,y arrays) that are stored in a SQL Server 2008 database.</p>
  <p>A while ago - with your help - I was able to get the data into a format I know how to work with.</p>
  <p><a href="https://stackoverflow.com/questions/53159706/python-3-decode-spectroscopy-data-base64-ieee754">Python 3 - decode spectroscopy data (Base64, IEEE754)</a></p>
  <p>At the moment I use the <code>SQLCMD</code> tool to access the database via:</p>
  <pre><code>p = Popen([&quot;sqlcmd&quot;, &quot;-S&quot;, host, &quot;-U&quot;,...], stdin=PIPE, stdout=PIPE, stderr=PIPE)
  output = p.stdout.read()
  </code></pre>
  <p>This is the only way I get the output I know how to deal with:</p>
  <pre><code>0xA79DFD6F14DCC23F242D1E1DFF50C43FAE9C624BD174...
  </code></pre>
  <p>Now I am not allowed to use the <code>SQLCMD</code> tool anymore and need to get the data via pyodbc. I use pandas as well.</p>
  <p>I try the following and it works well for all columns of the database but the important one.</p>
  <p>I'm lost here - can you please advise how to proceed? The output looks like:</p>
  <pre><code>[(b'\xa7\x9d\xfdo\x14\xdc\xc2?$-\x1e\x1d\xffP\xc4?\xae\x9cbK\xd1t\xc4?\x8a\xfc}a
  </code></pre>
  <p>and the settings I use are as follows:</p>
  <pre><code>sql_conn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
  
  query1 =  '''SELECT TOP 1 [DATA] FROM [ABC].[dbo].[DATABASE]'''
  
  df_q1 = pd.read_sql(query1, sql_conn)
  </code></pre>
  <p>I messed with encoding settings and failed.</p>
  <p><a href="https://i.stack.imgur.com/MiKNn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MiKNn.png" alt="enter image description here" /></a></p>
  <p>EDIT:
  <code>array.array('d', df_q1.Data[0])</code> gives the expected numbers.</p>