title: SQLAlchemy Query not returning all of large text field
body: <p>First up, here's a little bit about my environment:</p>
  
  <ul>
  <li>Using MSSMS as my database management tool.</li>
  <li>Using Django 1.3</li>
  <li>Using SQLAlchemy</li>
  </ul>
  
  <p>I have a text field in the database with no max length. There is text in it that is 890591 characters long.</p>
  
  <p>When I retrieve this field using <code>SQLAlchemy</code> it is truncated to 64512 characters. I've tried it with several other large rows too, and it's always truncated to 64512.</p>
  
  <p><code>SELECT @@TEXTSIZE</code> returns some absurd value like 1.6 million, so that's not the problem. If I do <code>SELECT DATALENGTH(field)</code> it returns the correct 890591. So it doesn't seem to be the database, it seems to be <code>SQLAlchemy</code>. Or perhaps it could be some Python limit.</p>
  
  <p>Any ideas? I seem to be at my wits end.</p>
  
  <p>EDIT: Here's some more info that was requested:</p>
  
  <p>OS: Debian 5.0.9</p>
  
  <p>SQLAlchemy: 0.7.3</p>
  
  <p>SQL: MS Sql Server 2008</p>
  
  <p>DB Connection: mssql+pymssql://name:password@server/dbname</p>
  
  <p>pymssql version: 1.0.2</p>
  
  <p>Model in question:</p>
  
  <pre><code>class RACReport(Base):
      __tablename__ = 'RACReport'
      id                      = Column(properUUID(), primary_key=True, nullable=False, default=genuuid4, server_default=text('NEWID()'))
      client_id               = Column(properUUID(), ForeignKey(Client.id), nullable=False)
      rawdata                 = Column(Text(), nullable=True)
      rawtime                 = Column(DateTime(), nullable=True, default=datetime.datetime.now())
      processeddata           = Column(Text(), nullable=True)
      processedtime           = Column(DateTime(), nullable=True)
      reportstartdate         = Column(DateTime(), nullable=False)
      reportenddata           = Column(DateTime(), nullable=False)
      numberofdocs            = Column(Integer(), nullable=True)
  RACReport.__table__.schema='rac'
  
  class properUUID(st.TypeDecorator):
      impl = mssql.MSUniqueIdentifier
      def process_result_value(self, value, dialect):
          if value:
              return str(uuid.UUID(bytes_le=value))
  
  def genuuid4():
      return str(uuid.uuid4())
  </code></pre>
  
  <p>rawdata and processdata are the two fields he is having the problem with.</p>
  
  <p>Here's a test query and echo:</p>
  
  <p><code>rac.session.query(rac.RACReport).filter(rac.RACReport.id=='8fb76cb7-d752-45af-a20a-3b85d5e7b8a6').all()</code></p>
  
  <p><code>2011-11-17 09:39:46,890 INFO sqlalchemy.engine.base.Engine SELECT [RACReport_1].id AS [rac_RACReport_id], [RACReport_1].client_id AS [rac_RACReport_client_id], [RACReport_1].rawdata AS [rac_RACReport_rawdata], [RACReport_1].rawtime AS [rac_RACReport_rawtime], [RACReport_1].processeddata AS [rac_RACReport_processeddata], [RACReport_1].processedtime AS [rac_RACReport_processedtime], [RACReport_1].reportstartdate AS [rac_RACReport_reportstartdate], [RACReport_1].reportenddate AS [rac_RACReport_reportenddate]
  FROM rac.[RACReport] AS [RACReport_1]
  WHERE [RACReport_1].id = %(id_1)s
  2011-11-17 09:39:46,890 INFO sqlalchemy.engine.base.Engine {'id_1': '8fb76cb7-d752-45af-a20a-3b85d5e7b8a6'}</code></p>