[Sqlalchemy-tickets] Issue #3504: SQL Server VARCHAR(MAX) on reflection can't compile or print (zzz
Brought to you by:
zzzeek
|
From: adridg <iss...@bi...> - 2015-07-30 12:27:59
|
New issue 3504: SQL Server VARCHAR(MAX) on reflection can't compile or print https://bitbucket.org/zzzeek/sqlalchemy/issues/3504/sql-server-varchar-max-on-reflection-cant adridg: With SQL Server, you can create columns of type VARCHAR(MAX). This is the modern rendition of NTEXT or TEXT, and SQL Alchemy translates String() into VARCHAR(MAX). With SQL Server 2012 or later, this happens automatically, and it's described in http://docs.sqlalchemy.org/en/latest/changelog/changelog_10.html#change-f520106ec3455eaa056110c048aa4862 . However, on reflection (through the inspector) you can end up with a VARCHAR (sql type-)object that has a length of "max" (i.e. a string). Printing that object causes an exception. As a very simple and contrived example: from sqlalchemy import VARCHAR print VARCHAR() print VARCHAR(80) print VARCHAR("max") # Fails in _render_type_string Attached find a simple test program that creates a table with a String() column, then reflects it to discover the VARCHAR(MAX) column. |