SQLAlchemy Truncating VARCHAR(MAX)

混江龙づ霸主 提交于 2019-12-24 00:17:52

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/17844667/sqlalchemy-truncating-varcharmax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!