Using sqlobject 0.9.9 with pymssql 1.0.1 on RHEL 5.3 (the
aforementioned have been installed with yum via either the base OS
packaeges or EPEL).
I have a class defined similar to the following:
class SystemsInfo(SQLObject):
class sqlmeta:
style = MixedCaseStyle(longID=True)
fromDatabase = False
table = 'SystemsInfo'
idType = str
idName = 'SystemName'
lazyUpdate = True
Department = StringCol(length=30, default=None)
Vendor = StringCol(length=80, default=None)
Model = StringCol(length=80, default=None)
... (lots more columns)
And eventually a very simple query as follows:
a = SystemsInfo.select(SystemsInfo.q.id == "SYSNAME")
item = a.getOne()
Debug output shows the following:
1/Select : SELECT SystemsInfo.SystemName, SystemsInfo.Department,
SystemsInfo.Vendor, SystemsInfo.Model FROM SystemsInfo WHERE
((SystemsInfo.SystemName) = ('SYSNAME'))
1/QueryR : SELECT SystemsInfo.SystemName, SystemsInfo.Department,
SystemsInfo.Vendor, SystemsInfo.Model FROM SystemsInfo WHERE
((SystemsInfo.SystemName) = ('SYSNAME'))
(Truncated some of the columns obviously)
But I get the following backtrace:
Traceback (most recent call last):
File "./matrix", line 206, in ?
main(sys.argv)
File "./matrix", line 171, in main
item = a.getOne()
File "/usr/lib/python2.4/site-packages/sqlobject/sresults.py", line 255, in getOne
results = list(self)
File "/usr/lib/python2.4/site-packages/sqlobject/sresults.py", line 162, in __iter__
return iter(list(self.lazyIter()))
File "/usr/lib/python2.4/site-packages/sqlobject/sresults.py", line 170, in lazyIter
return conn.iterSelect(self)
File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py", line 410, in iterSelect
select, keepConnection=False)
File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py", line 798, in __init__
self.dbconn._executeRetry(self.rawconn, self.cursor, self.query)
File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py", line 344, in _executeRetry
return cursor.execute(query)
File "/usr/lib/python2.4/site-packages/pymssql.py", line 188, in execute
raise OperationalError, e[0]
pymssql.OperationalError: SQL Server message 170, severity 15, state 1, line 1:
Line 1: Incorrect syntax near '='.
Now, it appears to me the syntax shown in the debug output is valid, an
indeed running it from isql seems to work fine.
However, I inspected the query via tcpdump/wireshark and noticed that
in the packet, the portion of the query after WHERE
((SystemsInfo.SystemName) = is some funky unprintable characters and
certainly not the name of the system...
Other queries seem to show the same thing happening... strings I am
providing to sqlobject are getting transmitted as gibberish even though
sqlobject's debug output shows them as valid.
Almost seems like a locale type issue...
Anyone have any ideas on what the fix is here?
Thanks,
Ray
|