Closed GoogleCodeExporter closed 9 years ago
Can you give me the exception you are getting please. Also, Python 2.4 is not
officially supported. I'm not saying that is the problem, just FYI.
Original comment by rsyr...@gmail.com
on 2 Mar 2012 at 7:37
Hi,
I get the following:
ProgrammingError: (102, "Incorrect syntax near 'd'.")
WARNING: Failure executing file:
</home/titan/schwartz/tmp/zerosinexecmany.py>
Original comment by schwar...@gmail.com
on 2 Mar 2012 at 7:55
Are you sure zeros are the problem? Looking at your code, my guess is that you
have a problem with the way you are passing parameters to executemany().
'data' variable in your example should be a list of tuples, not a list of
integers. Also, the way you are using execute() is dangerous and can result in
SQL injection problems. Don't use python string interpolation, let pymssql
substitute the params.
Original comment by rsyr...@gmail.com
on 6 Mar 2012 at 2:56
That story checks out ... when I changed my executemany from a list of
integers to a list of tuples the problem went away. So I this can be
safely written off as 'user error' :)
On a side note: wouldn't it have been useful if when I originally passed in
my integer list if pymssql could have risen a ValueType error and pointed
out my mistake? The way it is now, there's no indication I am misusing the
package unless I try inserting a 0.
Original comment by schwar...@gmail.com
on 6 Mar 2012 at 7:29
Original issue reported on code.google.com by
schwar...@gmail.com
on 2 Mar 2012 at 5:38Attachments: