That worked, thanks! On Tue, Nov 10, 2020 at 8:42 AM Mike Bayer <mike...@zzzcomputing.com> wrote: > > that's a hostname connection so it requires that you also include the driver > name in the URL. follow the example at > https://docs.sqlalchemy.org/en/14/dialects/mssql.html#hostname-connections . > > more background on connecting with pyodbc at > https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-Linux > . if you can get pyodbc to connect directly we can show you the correct URL > format. > > > On Mon, Nov 9, 2020, at 11:22 PM, Larry Martell wrote: > > sqlacodegen mssql+pyodbc://user:password@host/database > > > On Monday, November 9, 2020 at 11:03:03 PM UTC-5 Mike Bayer wrote: > > > this has to do with how you are formatting your URL, and it is being seen as > a hostname and not a DSN name. can't provide any more help without seeing > how you are formatting this URL as well as what is the actual method you are > trying to use to connect (DSN or hostname). > > > > > On Mon, Nov 9, 2020, at 6:44 PM, Larry Martell wrote: > > I am trying to use sqlacodegen on a mac to generate models from a MS SQL db. > I get this error when I run: > > sqlacodegen mssql+pyodbc:xxx > > pyodbc.InterfaceError: ('IM002', '[IM002] [unixODBC][Driver Manager]Data > source name not found and no default driver specified (0) (SQLDriverConnect)') > > I can successfully connect to the db using the same DSN: > > $ python3.8Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) > > [Clang 6.0 (clang-600.0.57)] on darwin > > Type "help", "copyright", "credits" or "license" for more information. > > >>> from sqlalchemy import create_engine > > >>> create_engine("mssql+pyodbc://xxx") > > /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sqlalchemy/connectors/pyodbc.py:80: > SAWarning: No driver name specified; this is expected by PyODBC when using > DSN-less connections > > util.warn( > > Engine(mssql+pyodbc://xxx) > > > >>> >
-- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CACwCsY5Twt5xSfRh-JCno7e%2BT7LqT0pnC81jYa%2B%3D0NP3aznv9Q%40mail.gmail.com.