make it clear that Text() is generally an "unlengthed" type

Issue #1841 resolved
Former user created an issue

On SQLServer, creating a table with a column of type sqlalchemy.Text(50) gives the error Cannot specify a column width on data type text.

General advice is to use the VARCHAR type. But I'm trying to create a generic application, so the Text type should work ...

Would it be possible for SQL Server to convert Text to VARCHAR if it has a length? Or is there a better way of handling this?

Comments (5)

  1. Former user Account Deleted

    In addition, the text type on SQL Server cannot compare items with an equals to (=) operator...

  2. Mike Bayer repo owner

    if you have a length, you should generally use String(), not Text(). We have done some automatic "switching" of these types in the past based on length present or not (the reverse of this case, actually) but that's no longer the current practice.

    The documentation for Text doesn't seem to make this clear enough, that it's generally the "unlengthed" type, if the user were not familiar with the CLOB and TEXT types.

  3. Log in to comment