-
Notifications
You must be signed in to change notification settings - Fork 103
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
Python 3 unicode problem in CursorWrapper.format_sql. #47
Comments
Any update on this? |
The problem is still present with django 1.7.7 and python 3.4 on MacOSX, connecting to MSSQL 2004. |
I tried the above suggestion to comment out the utf-8 encoding, and it did not solve the problem. After that change the query for the product version returns None, which breaks the code in operations.py line 67 that branches according to MSSQL version. |
I just tried for curiosity and got no problem using django-pyodbc 0.3.0 with python 3.4, Mac OSX, freetds 0.95.21, pyodbc 3.0.10 and django 1.7.10 when connecting to mssql express 2014. First the same error in format_sql you cite above happened but setting Strange errors like corrupted transactions or even not being able to install django-pyodbc using pip happened on ubuntu server 14.04.3 but that seems to be another story 😕 |
I would like to fix pyodbc package to support Python 3 and I will open PR when it's ready. Can any maintainers please prime me on what process to take as I attempt this, thank you |
We have the test suite for django 1.4, 1.5, and 1.6. They may be old, but they exercise the codebase. Do the conversion and see what shakes out from those tests. Then, submit a pull request and we will review it. |
Thanks mr Rogers
|
hey, this is github, no jokes allowed :) |
Christoph, I was assigned this ticket at work and on django 1.7.7, python 3.4 on ubuntu 14.04, connecting to MSSQL 2004 using django-pyodbc 0.2.6 (same stack as Adrian except I use ubuntu) I was able to get our API running with only 'driver_supports_utf8': True,' I saw a second solution suggesting which doesn't break it but doesn't fix it without your driver_supports_utf8 suggestion. I would close this ticket with an explanation to explicitly set driver_supports_utf8=True, I don't think this is a bug I saw gonna dive in and change your source but changing this in settings.py was sufficient |
I'm struggling to get a project going. I'm new to python and django. Is django_pyodbc supported on Python 3.5.1 and django 1.9? If not could you suggest a combination of python & django that is known to work with MS SQL Server 2012? Here are the details: I've set up a virtual environment with windows 7 64 bit, python 3.5.1, and these packages installed:
The database definition in settings.py:
When I try to run the development server I'm getting these errors:
|
Similar setup (not same) as @devanroberts here. Same error as his (NotImplementedError....). |
Major +1 |
Dear All, I am using django-pyodbc-azure 2.1.0.0 (https://pypi.org/project/django-pyodbc-azure/) which is a modern fork of django-pyodbc, a Django Microsoft SQL Server external DB backend that uses ODBC by employing the pyodbc library. It supports Microsoft SQL Server and Azure SQL Database. |
Hello,
I have been trying to get django-pyodbc working to connect to a SQL Server 2000 MSDE instance. I am using Django 1.6.1, Python 3.3 on Ubuntu 12.04.
Trying to do a simple operation such as
causes the following to happen
Someone else experienced the same problem except they were running on Windows. They asked a question on StackOverflow here:
http://stackoverflow.com/questions/21272895/cant-query-sql-server-from-django-using-django-pyodbc
I tracked the problem down to line 367 in base.py:
It seems that in Python 3, str.encode returns a bytes which is not a string type causing the TypeError to occur.
See this comment on StackOverflow for information on how the string/bytes changed from Python 2 to 3.
http://stackoverflow.com/a/11596746/1040695
This only seems to occur for the first query getting the product version. I need to do more analysis to see if happens later on.
Anyway, my quick fix was to comment out lines 364-367 in base.py.
Alternatively, the bytes could be converted back to a string by changing line 367 to
I hope this helps someone workaround this bug. I don't know enough about django-pyodbc to be able to fix this properly.
Michael.
The text was updated successfully, but these errors were encountered: