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

Problems with detecting parameter markers #47

Closed
jamartinh opened this issue May 12, 2015 · 6 comments
Closed

Problems with detecting parameter markers #47

jamartinh opened this issue May 12, 2015 · 6 comments

Comments

@jamartinh
Copy link

pyodbc.ProgrammingError: ('The SQL contains 0 parameter markers, but 12 parameters were supplied', 'HY000')

I have this problem when using insert into x values (?,?)

@jamartinh
Copy link
Author

It seems is a problem with ODBC API ?

@keitherskine
Copy link
Collaborator

If you really want help with this issue Jose, you're going to have to provide a lot more information. What version of pyodbc are you using? What system are you running on (Windows/Linux)? What version of Python are you using? Better still, provide some sample code that demonstrates the error.

@jamartinh
Copy link
Author

Hello keitherskine, thanks for reply.
Fortunately, I found the problem. The database where I was trying to make an insert (Hive) does not support insert into (current version) and it returned some code that the ODBC API can't understand. The problem is that in this case, pyodbc as pypyodbc returns that the problem is in the wrong number of parameters instead of just returning unkown error simply or compile error.

I had to step into pyodbc source to see the problem.

Thanks,
Jose

@keitherskine
Copy link
Collaborator

You found the source of the issue? Excellent. Is it worth letting everybody know what the error you received was, and what line of the pyodbc source code was affected by this? That would be helpful.

@jamartinh
Copy link
Author

https://github.com/mkleehammer/pyodbc/blob/master/src/params.cpp#L653

function bool PrepareAndBind

The errors raises in:
https://github.com/mkleehammer/pyodbc/blob/master/src/params.cpp#L731

But the problems is in the value of variable ret. ODBC API returns that the query string is good. Maybe the problem is that Hive does not return an error.

@mkleehammer
Copy link
Owner

Perhaps the error message could be updated, but it does tell you what you need to know:

The SQL contains 0 parameter markers, but 12 parameters were supplied

Parameter markers are the question marks "?". There are no question marks in the SQL (0 parameter markers) but you provided 12 parameters.

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