2

I'm querying Microsoft SQL Server 2008 with Flask-SQLAlchemy (.16) and SQL Alchemy (0.8.2) in python 2.7.

When I attempt to query the varchar(max) column. It is truncating it to 4096 characters. I've tried different data types in the code. String, Text, VARCHAR.

Any thoughts to get my code to pull all the data from my column?

Here is part of the code:

from web import db

class DynamicPage(db.Model):
    __tablename__ = 'DynamicPage'
    DynamicPageId = db.Column(db.Integer, primary_key=True)
    PageHtml = db.Column(db.VARCHAR)

And the query:

pages = DynamicPage().query.all()
CodeLikeBeaker
  • 20,682
  • 14
  • 79
  • 108

1 Answers1

2

Are you using ODBC? FreeTDS? ODBC has a fixed maximum size for large text/binary fields. In FreeTDS you need to set the text size setting to support as large a field as you need.

zzzeek
  • 72,307
  • 23
  • 193
  • 185
  • @CodeLikeBeaker: I am experiencing the same issue. Could you clarify here a bit? Are you saying: Using pyodbc without SQLAlchemy solved the issue? That I can reproduce. Or are you saying: If I am using pyODBC with SQLAlchemy, it fixes the issue? In this case, I am wondering how do you setup pyODBC with SQLAlchemy? I have already tried setting the text size to be 2Gb in essence. This does not solve my problem. What was linked to in the link? It's hard to see how that link help point you in the right direction since the link is no longer active. – Thornhale Oct 18 '17 at 23:11