-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Q: Is there a way to use this with ORMs, such as SQLAlchemy? #15
Comments
Hi! Thanks for the question. SQLAlchemy support has not landed yet, so it is not that easy yet. BUT: My colleague @bjoernmeier already put some work in that. He has even created a pull request for exasol/sqlalchemy-exasol#50, a project which adds a dialect for the Exasolution database. It is probably not as general as one would wish, but it is a start. |
You would definitely keep your existing FreeTDS driver, though. |
Short update: The pull request I mentioned above has been accepted. |
I'll try creating a SQLAlchemy dialect for mssql + turbodbc, should be fairly trivial, (except perhaps for unicode data). |
@dirkjonker That would be really awesome! The unicode stuff needs fixing on the turbodbc side, obviously. You could have a look at the codebase of https://github.com/blue-yonder/sqlalchemy_exasol for inspiration. I am not really familiar with that code base, but I suspect a little cargo culting in there ;-). If you encounter turbodbc issues, please keep reporting them :-) |
Status update on the MSSQL + turbodbc dialect. It works in certain situations but there are still some weird cases with "invalid cursor state" errors and situations where SQLAlchemy is calling rollback without an active transaction, which also raises errors. Those can probably be solved in the dialect, but I'll report if it's actually turbodbc that is causing problems. As soon as I have something that works reasonably well I'll release an alpha version under MIT license, should be somewhere this week. |
That sounds great! |
Took me a bit longer than expected (priorities, learning C, etc.) but I have created a very simple SQLAlchemy dialect for turbodbc + SQL Server. https://github.com/dirkjonker/sqlalchemy-turbodbc Feel free to fork/clone/report bugs/create pull requests/etc. |
Excellent news @dirkjonker! Good job! If you want, you could create a pull request to include a small SQLAlchemy section in the Readme that mentions your efforts and those at https://github.com/blue-yonder/sqlalchemy_exasol. Otherwise I will just add the note myself :-). |
@MathMagique of course! Here you go: #66 |
Since the answer to this question is now part of the Readme, and there is initial support for MSSQL with SQLAlchemy, I'll mark this question as resolved. |
This looks awesome.
Is it as simple as swapping out a connection string for our existing
pyodbc
string?connection_string = 'mssql+pyodbc:///?odbc_connect=%s' % connect_str
We're currently using a FreeTDS driver, would we change that?
Thanks
The text was updated successfully, but these errors were encountered: