title: Building a connection URL for mssql+pyodbc with sqlalchemy.engine.url.URL
body: <h1>The problem...</h1>
  
  <p>I am trying to connect to a MSSql server via SQLAlchemy.  Here is my code with fake credentials (<em>not my real credentials obviously</em>).</p>
  
  <h1>The code...</h1>
  
  <pre><code>credentials = {
  'username'  : 'SPOTTER_xyz_ACC',
  'password'  : '123Goodbye2016!@#',
  'host'      : 'MARYLQLT01',
  'database'  : 'LRS_DUS',
  'port'      : '1560'}
  
  connect_url = sqlalchemy.engine.url.URL(
      'mssql+pyodbc',
      username=credentials['username'],
      password=credentials['password'],
      host=credentials['host'],
      port=credentials['port'],
      query=dict(service_name=credentials['database']))
  
  engine = create_engine(connect_url)
  connection=engine.connect()
  </code></pre>
  
  <p>And this is the .pyodbc error that I am getting.</p>
  
  <pre><code>(pyodbc.Error) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source
  name not found and no default driver specified (0) (SQLDriverConnect)')
  </code></pre>
  
  <h1>Additional Details</h1>
  
  <p>But, here is what is weird... I if make a pyodbc connection and use Pandas.read_sql, then I can get data without an error.  So I do not understand why I am getting a 'pyodbc' error????</p>
  
  <pre><code>connection=pyodbc.connect(\
                            'Driver={SQL Server}; \
                            Server=MARYLQLT01; \
                            Database=LRS_DUS; \
                            UID=SPOTTER_xyz_ACC; \
                            PWD=123Goodbye2016!@#')
  
  stmt='select * from PD_SC_All'
  df=pd.read_sql(stmt,connection)
  </code></pre>
  
  <p>And then I can see the dataframe.</p>
  
  <p>So, why am I getting the <code>(pyodbc.Error)</code> when I try to connect with SQLAlchemy?</p>
  
  <h2>System Information</h2>
  
  <pre><code>Windows 7
  SQLAlchemy: 1.1.11
  pyodbc: 4.0.16
  
  Python 3.6.1 |Anaconda custom (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]
  Type "copyright", "credits" or "license" for more information.
  
  IPython 5.3.0 -- An enhanced Interactive Python.
  ?         -&gt; Introduction and overview of IPython's features.
  %quickref -&gt; Quick reference.
  help      -&gt; Python's own help system.
  object?   -&gt; Details about 'object', use 'object??' for extra details.
  </code></pre>