title: Using pandas to read 'read-only' SQL
body: <p>I was trying to read the sql table into pandas data frame with the following code:</p>
  
  <pre><code>import pandas as pd
  import pyodbc as pb 
  
  conn = pb.connect(
      'DRIVER={SQL Server Native Client 11.0};'
      'SERVER=server_name;'
      'DATABASE=db;'
      'Trusted_Connection=yes'
      )
  
  sql_builder = pd.read_sql_query(
      'SELECT * from schema.table',conn
  )
  
  df=pd.DataFrame(sql_builder)
  </code></pre>
  
  <p>And it had the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "c:/Users/user/Desktop/SQL.py", line 6, in &lt;module&gt;
      'DRIVER={SQL Server Native Client 11.0};'
  pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]The target database ('db') is in an availability group and is
  currently accessible for connections when the application intent is set to read only. For more information about application intent, see SQL Server Books Online. (978) (SQLDriverConnect); [42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]The target database ('dbDepot') is in an availability group and is currently accessible for connections when the application intent is set to read only. For more information about application intent, see SQL Server Books Online. (978)")
  </code></pre>
  
  <p>My question is, how can I read read-only table into pandas data frame?</p>