问题
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