-
Notifications
You must be signed in to change notification settings - Fork 102
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
The SQL contains 0 parameter markers, but 1 parameters were supplied #35
Comments
Sorry about the delay in getting back (I blame the holidays). Can you print the parameters referenced in that exception and your database configuration? |
Thanks for getting back to me. The error seems to be thrown on a simple get on a model, e.g. Foo.objects.get(foo='bar'). Here's my db configuration (with some of the real values changed for the purposes of this post): DATABASES = {
'default': {
'ENGINE': 'django_pyodbc',
'NAME': 'mydb',
'USER': 'user',
'PASSWORD': 'pass',
'HOST': 'mysqlserver.mydomain.com',
'PORT': 1433,
'OPTIONS': {
'driver': 'FreeTDS',
'host_is_server': True,
'extra_params': 'TDS_VERSION=8.0'
}
}
} Let me know if that wasn't what you were asking for, and thanks again for the response. |
I am getting the same error while attempting a syncdb. Have you made any progress, @mpwoodward ? Any ideas @dlo ?
|
Not sure if this is the exact scenario but we started getting this error immediately after upgrading to Django 1.6.7 from 1.5 (finally). The feature that was causing this error for us was using the limiting syntax in the following way:
which used to give me all the model objects except the newest one but in 1.6.7 I get this exception. Something in this notation generates some very strange, nested SQL for this simple query. The Django site did not mention the deprecation of any slicing syntax so maybe this is a bug in Django. |
Same error in django 1.7 with pyodbc 3.0.8 and django-pyodbc 0.2.5. |
I think a regression may have been introduced between django-pyodbc versions 0.2.4 and 0.2.5. I did some simple tests using the Django tutorial project. With 0.2.5, the following produce the error mentioned in this thread: Poll.objects.filter(question__icontains='what')[1:2]
Poll.objects.filter(question__icontains='what')[1:]
Poll.objects.filter(question__icontains='what')[1] However this worked: Poll.objects.filter(question__icontains='what')[:2] Downgrading to 0.2.4, all the above four worked fine. Using Django 1.6.7, pyodbc 3.0.7, SQL Server 2008 R2, Mac OS X 10.9.5. |
Most of the changes between 0.2.4 and 0.2.5 are in this commit: 5edfafa I think the ideal thing for this project would be to get it in the hands of a maintainer who uses SQL Server on a daily basis--as of late most of my stack has been PostgreSQL-based. If anyone would like to volunteer and / or submits a PR, I'll gladly hand over the reigns. |
I logged the SQL generated from my earlier examples that failed in 0.2.5. The only difference is this phrase: 0.2.5: 0.2.4: @dlo, I don't have time at the moment to dig into the source, but I'll try to get back to it at some point and see what may have happened. I do appreciate your efforts on this project, though. |
Setup - I'm experiencing the same issues as above using Python 2.7.8 with the following libraries in my virtualenv. Additional details of my setup are on the answer here (Note: I can connect to the MS SQL Server through isql and tsql so the connection isn't the issue) Django==1.6.8 Error Message - I can do a 'manage.py runserver' just fine, but ran into the same issue with 'manage.py syncdb' and got this error:
Troubleshoot - I put a pdb.set_trace() on the line before crashing and here's the values from the
Looking up this type of error here I see that SQLState 42000 has error state 'Syntax error or access violation' with a description of:
So I'm not sure where to go from here. Any suggestions? Thanks! |
I also have this problem on Mac running OSX 10.9. I can access the db using tsql and isql. I've been able to narrow it down some:
I believe the problem is likely a double conversion to/from utf-8 somewhere in the code, but I'm not really sure which layer to look in. |
@adriannye thanks for looking into this. if you have any ideas, or have the capability to test out some hypotheses, please do if you have the time. I no longer am working on any projects with a SQL Server DB, so it's a bit tough for me to make any progress here :) |
A little more information...the working web service is accessing SQL Server 2005, while the broken one is accessing SQL Server 2008. |
Seems the issue is a regression in pyodbc. On Mac only it returns UTF16 in a case that should be UTF8. I changed a cpp file in the pyodbc 3.0.7 source and everything now works for me. See this ticket: |
Getting this error on Mac OS 10.9, Python 2.7.5, Django 1.5.4, SQL 2008:
Happens on any view function that has any database interaction (i.e. isn't limited to a specific database operation). Happy to provide additional details as I can.
The text was updated successfully, but these errors were encountered: