0

I am trying to connect to an SQL Server from a version of python (pythonista) that requires that I use pure python drivers. I am able to connect using pytds if I don't use sqlalchemy so I know this works.

However, I would like to be able to use sqlalchemy so I installed sqlaclhemy-pytds but when I try:

engine = create_engine('mssql+pytds://' +various params)

I get:

Can't load plugin:
sqlalchemy.dialects:mmsql.pytds

What am I overlooking?

ihf
  • 51
  • 1
  • 9
  • Make sure you're using the same version of python you installed sqlalchemy-pytds for, and that you are using the same virtual environment, if it was installed in such. – Ilja Everilä Mar 02 '20 at 11:47

2 Answers2

1

I finally got it working by adding: https://github.com/m32/sqlalchemy-tds.git

I thought I got that when I did:

pip install sqlalchemy-pytds pip install python-tds

especially since the pip list showed

python-tds (1.9.1) - Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation

but apparently the sqlalchemy MSSQL dialect is different and is not available via pip and must be imported as sqlalchemy_tds

Thanks to everyone who replied.

ihf
  • 51
  • 1
  • 9
  • Sounds like a PyPI packaging issue. You may want to [take it up with the developer](https://github.com/m32/sqlalchemy-tds/issues). – Gord Thompson Mar 04 '20 at 12:53
0

According to the SQLAlchemy dialects page it looks like you'll need to use the external dialect here:

https://github.com/m32/sqlalchemy-tds

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
  • As my post indicated, I installed sqlalchemy-pytds. Are you suggesting something else? Pip list shows I have python-tds and sqlalchemy-pytds. – ihf Mar 03 '20 at 12:30
  • Check your spelling. Did you type `mmsql+pytds` instead of `mssql+pytds` ? – Gord Thompson Mar 03 '20 at 14:03
  • Wow, you had me going there for one second. I spelled it correctly. – ihf Mar 04 '20 at 02:56