Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6835055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:11:12+00:00 2026-05-26T23:11:12+00:00

First up, here’s a little bit about my environment: Using MSSMS as my database

  • 0

First up, here’s a little bit about my environment:

  • Using MSSMS as my database management tool.
  • Using Django 1.3
  • Using SQLAlchemy

I have a text field in the database with no max length. There is text in it that is 890591 characters long.

When I retrieve this field using SQLAlchemy it is truncated to 64512 characters. I’ve tried it with several other large rows too, and it’s always truncated to 64512.

SELECT @@TEXTSIZE returns some absurd value like 1.6 million, so that’s not the problem. If I do SELECT DATALENGTH(field) it returns the correct 890591. So it doesn’t seem to be the database, it seems to be SQLAlchemy. Or perhaps it could be some Python limit.

Any ideas? I seem to be at my wits end.

EDIT: Here’s some more info that was requested:

OS: Debian 5.0.9

SQLAlchemy: 0.7.3

SQL: MS Sql Server 2008

DB Connection: mssql+pymssql://name:password@server/dbname

pymssql version: 1.0.2

Model in question:

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())

rawdata and processdata are the two fields he is having the problem with.

Here’s a test query and echo:

rac.session.query(rac.RACReport).filter(rac.RACReport.id=='8fb76cb7-d752-45af-a20a-3b85d5e7b8a6').all()

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'}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:11:13+00:00Added an answer on May 26, 2026 at 11:11 pm

    I know little of *nix connectivity to SQL Server, but simple googling suggests that the issue is related to FreeTDS configuration:

    1. A related question on SO: Data ended at 64512 characters – MSSQL // PHP // OPENSuSE // APACHE2.
    2. Another Q&A extracted from here:

    My text data are being truncated or are causing my client to break.

    The text data type is different from char and varchar types. The
    maximum data length of a text column is governed by the textsize
    connection option. Microsoft claims in their documentation to use a
    default textsize of 4000 characters, but in fact their implementation
    is inconsistent. Sometimes text columns are returned with a size of 4
    GB!

    The best solution is to make sure you set the textsize option to a
    reasonable value when establishing a connection. For example:

    1> set textsize 10000 
    2> go 
    

    See also the text size option in freetds.conf.


    And just a side note: you seem to be using rather outdated version of pymssql.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First here's what I'm using and trying to do: the minimal setup for this
First post here... I normally develop using PHP and Symfony with Propel and ActionScript
Setup Using MVC 3 + Code First Here are my classes public class Member
n00b here (first Android project). I have been given a custom video codec that
Hello all,I'm a junior on html,I have a question about css position : first
First here is my code: I have commented the problem lines protected void Page_Load(object
this might be a bit tricky. First here is my function: public function transfer_smf_userinfo($username)
I have the following problem First here is my code: $day_difference = 1; while
my first question here: I am having trouble using libcURL in a c++ project.
first question here. I have a BarChart showing several normal bars and a BarSeries,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.