pymssql-0.8.0
freetds-0.64
Python 2.3.4
RedHat Linux AS4
Talking to MS SQL Server 2005
This code works fine:
c = self.db.cursor()
params = {'name': name}
c.execute ("""select bf_pid from bf_projects
where bf_description = %(name)s""",
params
)
but if I try to avoid having to build the temporary params dict by just passing locals(), I get:
Traceback (most recent call last):
File "./getsteps.py", line 43, in <module>
main()
File "./getsteps.py", line 11, in main
pid = db.get_project_id ("CMP-DMT80-main-wsb")
File "./getsteps.py", line 30, in get_project_id
params
File "/usr/local/lib/python2.5/site-packages/pymssql.py", line 126, in execute
self.executemany(operation, (params,))
File "/usr/local/lib/python2.5/site-packages/pymssql.py", line 152, in executemany
raise DatabaseError, "internal error: %s" % self.__source.errmsg()
pymssql.DatabaseError: internal error: None
The dict returned by locals() has a 'name' entry. What magic is going on that's causing this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using:
pymssql-0.8.0
freetds-0.64
Python 2.3.4
RedHat Linux AS4
Talking to MS SQL Server 2005
This code works fine:
c = self.db.cursor()
params = {'name': name}
c.execute ("""select bf_pid from bf_projects
where bf_description = %(name)s""",
params
)
but if I try to avoid having to build the temporary params dict by just passing locals(), I get:
Traceback (most recent call last):
File "./getsteps.py", line 43, in <module>
main()
File "./getsteps.py", line 11, in main
pid = db.get_project_id ("CMP-DMT80-main-wsb")
File "./getsteps.py", line 30, in get_project_id
params
File "/usr/local/lib/python2.5/site-packages/pymssql.py", line 126, in execute
self.executemany(operation, (params,))
File "/usr/local/lib/python2.5/site-packages/pymssql.py", line 152, in executemany
raise DatabaseError, "internal error: %s" % self.__source.errmsg()
pymssql.DatabaseError: internal error: None
The dict returned by locals() has a 'name' entry. What magic is going on that's causing this?
Hello,
if you could paste the code that doesn't work.
Regards,
Andrzej