I was trying to create a database migration script with Alembic for my SQLServer database and having issues with the connection string.
This is what I have now:
sqlalchemy.url = "mssql+pyodbc://db_server/database?trusted_connection=yes&driver=ODBC Driver 17 for SQL Server"
Error message during alembic current
:
sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string '"mssql+pyodbc://dbserverxx/dbxx?trusted_connection=yes&driver=ODBC Driver 17 for SQL Server"'
I tested my script with SQLite and is working fine.
I'm using a Mac and the contents of odbcinst.ini
is as follows:
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/usr/local/lib/libmsodbcsql.17.dylib
UsageCount=2
I was able to connect to database using PyODBC and execute raw SQLs.
Any suggestions to have the right sqlalchemy.url
is appreciated.