Skip to content
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

supports_mars attribute error when using multiple databases. #158

Closed
ScottBarkman opened this issue Apr 12, 2018 · 3 comments
Closed

supports_mars attribute error when using multiple databases. #158

ScottBarkman opened this issue Apr 12, 2018 · 3 comments

Comments

@ScottBarkman
Copy link

ScottBarkman commented Apr 12, 2018

Ran into an issue when I was attempting to use this with multiple databases (MS sql server & postgresql) Whenever I would run a query on the sql server, followed by one on postgres - the postgresql one would fail with DatabaseWrapper has no attribute supports_mars

I traced this back to a method (_cursor_iter) inside of pyodbc/compile.py which appeared to be running on each database connection, including the postgresql one.

Adding a simple @ line 84:

if not hasattr(cursor.db, "supports_mars"):
    cursor.db.supports_mars = False;

solves the issue.

@jmelloy
Copy link

jmelloy commented Apr 12, 2018

I've been having this exact issue.

michiya added a commit that referenced this issue Apr 13, 2018
@michiya
Copy link
Owner

michiya commented Apr 13, 2018

Thank you for reporting and sorry for inconvenience. I have made the fix for this and pushed it to PyPI. Let me know if you still see the same error after upgrading django-pyodbc-azure to the latest version.

@ScottBarkman
Copy link
Author

No worries, thanks for the fix. I wasn't that confident with always assuming it doesn't support mars or I would have submitted a pull request.

Thanks again - works great installed from pypi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants