I figured it out finally. since I'm using MSSQL and FreeTDS, I had to work 
around a strange problem in FreeTDS that I'm guessing is a bug. Here is the 
StackOverflow page where the answer 
is: 
http://stackoverflow.com/questions/1060035/using-pyodbc-on-ubuntu-to-insert-a-image-field-on-sql-server#answer-1073801

Basically, it says that I need to prepend SET TEXTSIZE 2147483647 to my 
query. So this is the new line for my query:

rows = source.executesql('SET TEXTSIZE 2147483647 SELECT TOP 3 * FROM 
EmployeesPictures;')

This works when using executesql(), but is a problem if using db.define() 
with MSSQL, since the DAL would not automatically generate the SET TEXT part 
of the query.

Reply via email to