ihf
ihf

Reputation: 91

Using pytds with sqlalchemy

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?

Upvotes: 1

Views: 4386

Answers (2)

ihf
ihf

Reputation: 91

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.

Upvotes: 3

Gord Thompson
Gord Thompson

Reputation: 123399

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

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

Upvotes: 0

Related Questions